Self-Host Your Knowledge Base with Wiki.js on a VPS
Leave a comment on Self-Host Your Knowledge Base with Wiki.js on a VPS

In an era where businesses and teams depend heavily on documentation, having a reliable knowledge base is no longer optional; it’s essential. While cloud-based tools like Confluence, Notion, or GitBook are popular, they often come with high subscription costs, vendor lock-in, and limited customization. If you prefer full control, privacy, and scalability, self-hosting your knowledge base is the way to go.
One of the best open-source options available today is Wiki.js, a modern and powerful wiki software built on Node.js. Pairing it with a Virtual Private Server (VPS) gives you flexibility and ownership over your data.
Wiki.js is not your typical old-school wiki engine. It combines a sleek interface with robust features that make it suitable for both personal use and enterprise documentation. Hosting Wiki.js on a VPS gives you complete control and scalability.
Step 1: Update Your VPS
First, log in to your VPS via SSH and update your system:
sudo apt update && sudo apt upgrade -y
Step 2: Install Dependencies
Wiki.js requires Node.js, PostgreSQL, and Nginx if you want to use it as a reverse proxy.
Install Node.js using the LTS version:
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejs
Install PostgreSQL:
sudo apt install -y postgresql postgresql-contrib
Create a database and user for Wiki.js:
sudo -u postgres psql
Then run the following commands:
CREATE DATABASE wikijs;
CREATE USER wikiuser WITH ENCRYPTED PASSWORD 'yourpassword';
GRANT ALL PRIVILEGES ON DATABASE wikijs TO wikiuser;
\q
Install Nginx, which is optional but recommended for HTTPS:
sudo apt install -y nginx
Step 3: Install Wiki.js
Download and set up Wiki.js:
mkdir /var/www/wiki
cd /var/www/wiki
curl -sSo- https://wiki.js.org/install.sh | bash
During setup, Wiki.js will ask for your PostgreSQL credentials. Provide the wikijs database, wikiuser username, and the password you created earlier.
Step 4: Configure Wiki.js as a System Service
Create a systemd service file:
sudo vi /etc/systemd/system/wiki.service
Paste the following:
[Unit]
Description=Wiki.js
After=network.target
[Service]
Type=simple
User=www-data
WorkingDirectory=/var/www/wiki
ExecStart=/usr/bin/node server
Restart=always
[Install]
WantedBy=multi-user.target
Save and enable the service:
sudo systemctl enable wiki
sudo systemctl start wiki
Step 5: Configure Nginx (Reverse Proxy)
To serve Wiki.js over HTTPS with your domain, create the Nginx configuration file:
sudo vi /etc/nginx/sites-available/wiki
Add this configuration:
server {
listen 80;
server_name yourdomain.com;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Enable the configuration and restart Nginx:
sudo ln -s /etc/nginx/sites-available/wiki /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
Step 6: Access Wiki.js
Open your browser and visit:
http://yourdomain.com
Or:
http://your-server-ip:3000
Configure your admin account, choose your storage options, and start building your knowledge base!
Conclusion
Wiki.js self-hosting on a VPS is an affordable and effective way to manage documentation for your team, company, or yourself. You have control over your data, security, and customization, unlike SaaS solutions.
Wiki.js is more than capable of managing anything from private notes to extensive corporate documentation thanks to features like enterprise-ready authentication, Markdown editing, and Git integration.
At RackNerd, you can deploy a VPS with the flexibility and resources needed to host your own Wiki.js knowledge base and manage your documentation environment.
👉 Visit https://racknerd.com to learn more about our VPS hosting solutions.