What do you need for Wiki.js?
Wiki.js is a Node.js wiki with a Markdown and visual editor, page history, access groups and pluggable search and storage. Version 2 is the line the project documents for production use, and PostgreSQL is its recommended database.
- Ubuntu 24.04 or Debian 12/13 with Docker and Compose. The Docker app image includes both; otherwise follow Docker Engine install.
- DNS for
wiki.example.net. - About 1 GB of memory for a team wiki; 2 GB if you add a heavier search engine.
docker compose version
sudo mkdir -p /opt/wikijs && cd /opt/wikijs
printf 'DB_PASSWORD=%s\n' "$(openssl rand -hex 24)" | sudo tee .env
sudo chmod 600 .envHow do you write the Compose file?
Define a PostgreSQL service with a persistent folder and the Wiki.js service that reads its database settings from environment variables.
services:
db:
image: postgres:15-alpine
restart: unless-stopped
environment:
POSTGRES_DB: wiki
POSTGRES_USER: wikijs
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- ./db:/var/lib/postgresql/data
wiki:
image: ghcr.io/requarks/wiki:2
restart: unless-stopped
depends_on: [db]
environment:
DB_TYPE: postgres
DB_HOST: db
DB_PORT: "5432"
DB_USER: wikijs
DB_PASS: ${DB_PASSWORD}
DB_NAME: wiki
ports:
- "127.0.0.1:3000:3000"sudo docker compose up -d
sudo docker compose logs -f wiki
curl -sI http://127.0.0.1:3000 | head -n 1When the log shows that the HTTP server is listening, the local request returns a 200 or a redirect to the setup page. The loopback port mapping keeps Wiki.js off the public interface, which matters because Docker port rules bypass ufw.
How do you publish it with Nginx and HTTPS?
Add an Nginx site that proxies to port 3000 with WebSocket headers, then let Certbot add TLS and the HTTP redirect.
sudo apt install -y nginx certbot python3-certbot-nginx
sudo tee /etc/nginx/sites-available/wikijs >/dev/null <<'EOF'
server {
listen 80;
listen [::]:80;
server_name wiki.example.net;
client_max_body_size 50M;
location / {
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_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;
}
}
EOF
sudo ln -s /etc/nginx/sites-available/wikijs /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable
sudo certbot --nginx -d wiki.example.net --redirectThe upload limit of 50 MB covers images and attachments in the asset manager; raise it if you store larger files. For a Caddy setup instead, see the Caddy HTTPS tutorial.
How do you run the setup wizard?
Open https://wiki.example.net, enter the administrator email and a strong password, and set the site URL to the full HTTPS address.
The wizard creates the admin account and loads the default modules. Once inside, open Administration and work through a short list:
- General: set the site title and confirm the site URL.
- Users and Groups: create groups such as Editors and Readers, then set page rules per path, for example read-only access to
/handbookfor everyone. - Login: keep local accounts or add an external provider; turn off self-registration unless you want it.
- Search Engine: switch from the basic engine to PostgreSQL search for better results, which uses the database you already run.
Enable two-factor login for the admin under your profile.
How do you set up mail?
Fill in Administration, Mail with an authenticated relay on port 587, leave the secure (TLS on connect) switch off so the connection upgrades with STARTTLS, and send a test.
Sender name: Team Wiki
Sender email: wiki@example.net
SMTP host: smtp.example.net
SMTP port: 587
Secure (TLS): off (STARTTLS is negotiated)
Username: wiki@example.net
Password: relay passwordWiki.js mails password resets and invitations. Direct sending over port 25 is not assured on a VPS, so check with support by ticket before you plan on it, and keep the relay in place; send app mail through an SMTP relay explains the account and DNS side.
How do you keep pages in Git?
Turn on the Git storage target under Administration, Storage, and Wiki.js will commit each page as a Markdown file to a repository you control.
Create an empty private repository on your own forge (for example the Gitea instance from another guide), add a deploy key with write access, and enter the SSH URL, branch and private key in the storage settings. Choose bi-directional sync if editors should also change pages through Git, or push only if the wiki stays the source of truth. The result is a readable, versioned copy of the content that survives even if the database is lost.
How do you back up and upgrade Wiki.js?
Dump PostgreSQL on a schedule and update by pulling the newer image in the same major line.
cd /opt/wikijs
sudo docker compose exec -T db pg_dump -U wikijs wiki | gzip > /root/wiki-$(date +%F).sql.gz
sudo docker compose pull
sudo docker compose up -d
sudo docker compose logs --tail 30 wikiThe database holds pages, users, settings and uploaded assets, so the dump is the whole backup; the Git target adds a second copy of the page text. Restore with gunzip -c FILE | sudo docker compose exec -T db psql -U wikijs wiki into an empty database. Upgrading PostgreSQL itself to a new major version needs a dump and reload, not just a new tag. Copy dumps off the server and add the daily backup add-on for disk-level copies.
What should you check when Wiki.js fails?
Start with sudo docker compose logs wiki; database connection problems and module errors appear there in plain language.
- Database connection refused on start: PostgreSQL was still initialising; Wiki.js retries, or restart it once the db is up.
- Links and emails use the wrong host: fix the site URL under Administration, General.
- Editor does not save, connection errors: the WebSocket headers are missing in the Nginx block.
- Uploads rejected: raise
client_max_body_sizeand the upload limit in the asset settings.
Plans that fit this guide
Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.
Questions about Wiki.js
Should I wait for Wiki.js 3?
Use version 2 for a production wiki now. Watch the project announcements for the next major line and its migration notes before switching.
Can I use MySQL or SQLite?
Version 2 supports MySQL, MariaDB, SQL Server and SQLite too, but PostgreSQL is the recommended choice and enables the PostgreSQL search module.
Is Wiki.js good for public documentation?
Yes. Grant the Guests group read access to the paths you want public and keep editing rights for your team.
How much memory does Wiki.js use?
Roughly a few hundred megabytes with PostgreSQL for a small team, so 1 GB is enough unless other services share the server.
Can I import existing Markdown files?
Yes. Put them in the Git repository used by the storage target and run an import from the storage settings, or use the local disk target to import a folder.
More in Self-hosted apps
- Nextcloud on Nginx
- ownCloud Infinite Scale
- Seafile file sync
- Vaultwarden password vault
- Passbolt team password manager
- Gitea Git hosting
- Forgejo Git server
- GitLab Community Edition
- Gogs Git service
- BookStack documentation
- Outline knowledge base
- Paperless-ngx documents
- n8n workflow automation
- Activepieces automation
- Plausible Analytics (Community Edition)
- Umami analytics
- Mattermost team chat
- Matrix Synapse with Element
- Jitsi Meet video calls
- ONLYOFFICE Docs with Nextcloud
- HashiCorp Vault secrets server
- OpenBao secrets management
- Infisical secrets manager
- Authelia SSO and forward auth
- Zitadel identity platform
- VS Code in the browser (code-server)
- Joplin Server for notes sync
- Firefly III personal finance
- Snipe-IT asset tracking
- Odoo ERP on Ubuntu or Debian
- ERPNext with frappe_docker
- Dolibarr ERP and CRM with Nginx
- Penpot design tool with Docker
- Planka kanban boards
- Leantime project management
- Wekan boards with Docker
- Cal.com scheduling
- Chatwoot support inbox
- Mautic marketing automation
- DocuSeal document signing
- Metabase dashboards
- Appwrite backend server
- Self-hosted Supabase
- PocketBase backend
- RustDesk relay server
- Traccar GPS tracking
- Redmine project tracker
- The Lounge IRC client
- CyberChef data toolbox
- Typebot chat forms
- AFFiNE workspace
- Overleaf Community Edition
- Neko shared virtual browser
- imgproxy image resizing
- NetBox network inventory
- UVdesk help desk
- YetiForce CRM