Skip to content

Instantly share code, notes, and snippets.

@TheITProinfo
Forked from maximzhurkin/wikijs.md
Created June 5, 2022 00:05
Show Gist options
  • Select an option

  • Save TheITProinfo/1042154884794f9923bb89babb1e7085 to your computer and use it in GitHub Desktop.

Select an option

Save TheITProinfo/1042154884794f9923bb89babb1e7085 to your computer and use it in GitHub Desktop.
Install wiki.js on ubuntu

1. Install node & nginx

sudo curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt install nodejs
sudo apt install nginx

2. Setup mysql

sudo apt install mysql-server
sudo mysql_secure_installation

3. Cteate table and user

mysql>

CREATE DATABASE wiki;
CREATE USER 'wikijs'@'localhost' IDENTIFIED BY 'youpassword';
GRANT ALL PRIVILEGES ON * . * TO 'wikijs'@'localhost';
exit;

4. Install wiki.js

cd apps
wget https://github.com/Requarks/wiki/releases/download/2.5.201/wiki-js.tar.gz
mkdir wiki
tar xzf wiki-js.tar.gz -C ./wiki
cd ./wiki
mv config.sample.yml config.yml
nano config.yml
db:
  type: mysql
  host: localhost
  port: 3306
  user: wikijs
  pass: youpassword
  db: wiki

5. Install pm2

sudo npm i pm2 -g

6. Config nginx

sudo nano /etc/nginx/sites-available/default
server {
        listen 80 default_server;
        listen [::]:80 default_server;
        root /var/www/html;
        index index.html index.htm index.nginx-debian.html;
        server_name youdomain;
        location / {
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_pass http://127.0.0.1:3000/;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_next_upstream error timeout http_502 http_503 http_504;
        }
}
sudo /etc/init.d/nginx reload

7. Run wiki

pm2 start server

open in browser youip and setup wiki.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment