Ubuntu 22.04
Sponsored Link

Nginx : Install Wiki.js2022/12/08

 
Install Wiki.js which is the wiki engine.
On this example, configure it on a virtual host (rx-7.srv.world).
[1]
[2]
[3]
[4] Create a user and Database for Wiki.js.
root@www:~#
mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 37
Server version: 10.6.11-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database wikijs; 
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on wikijs.* to wikijs@'localhost' identified by 'password'; 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges; 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye
[5] Configure Wiki.js.
root@www:~#
mkdir /var/www/wikijs

root@www:~#
useradd -d /var/www/wikijs -s /sbin/nologin wikijs

root@www:~#
wget https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz

root@www:~#
tar zxvf wiki-js.tar.gz -C /var/www/wikijs/

root@www:~#
chown -R wikijs:wikijs /var/www/wikijs

root@www:~#
cp /var/www/wikijs/config.sample.yml /var/www/wikijs/config.yml

root@www:~#
vi /var/www/wikijs/config.yml
# line 23 : change for your database setting
db:
  type: mariadb

  # PostgreSQL / MySQL / MariaDB / MS SQL Server only:
  host: localhost
  port: 3306
  user: wikijs
  pass: password
  db: wikijs
  ssl: false

# line 102 : change listening IP address
bindIP: 127.0.0.1

root@www:~#
vi /etc/systemd/system/wikijs.service
[Unit]
Description=wiki.js app server
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/node server
Restart=always

User=wikijs
Environment=NODE_ENV=production
WorkingDirectory=/var/www/wikijs

[Install]
WantedBy=multi-user.target

root@www:~#
systemctl daemon-reload

root@www:~#
systemctl enable --now wikijs

[6] Configure Nginx.
root@www:~#
vi /etc/nginx/sites-available/wikijs.conf
# replace the hostname and certificate for yours
server {
        listen      80;
        listen      [::]:80;
        listen      443 ssl http2;
        listen      [::]:443 ssl http2;
        server_name rx-7.srv.world;
        root   /var/www/wikijs;

        ssl_certificate "/etc/letsencrypt/live/rx-7.srv.world/fullchain.pem";
        ssl_certificate_key "/etc/letsencrypt/live/rx-7.srv.world/privkey.pem";
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout  10m;

        location / {
                proxy_pass http://127.0.0.1:3000/;
                proxy_set_header    X-Real-IP $remote_addr;
                proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header    Host $http_host;
        }
}

root@www:~#
cd /etc/nginx/sites-enabled

root@www:/etc/nginx/sites-enabled#
ln -s /etc/nginx/sites-available/wikijs.conf ./

root@www:/etc/nginx/sites-enabled#
systemctl reload nginx

[7] Access to the URL of virtualhost you set from any client computer, then Wiki.js start page is shown. Input required information and click [INSTALL] button.
[8] Login as admin user and password you set.
[9] After successfully login to Wiki.js administration page, you can configure and create Wiki site on here.
Matched Content