Log inSign up

A Wiki.js knowledge base on your own server

Create a Compose file with ghcr.io/requarks/wiki:2 and a PostgreSQL container, publish Wiki.js on 127.0.0.1:3000, and proxy wiki.example.net to it with Nginx and a Certbot certificate. Finish in the browser setup wizard (admin email, password, site URL), then configure mail and a Git storage target so every page is also kept as Markdown in a repository.

Topic: Self-hosted apps · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13 · Updated 2026-12-03

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 .env

How 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 1

When 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 --redirect

The 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 /handbook for 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 password

Wiki.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 wiki

The 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_size and 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.

All prices
PlanFits becauseSizeMonthlyOrder from
A1-1personal or small team wiki1 vCPU, 1 GB RAM, 25 GB NVMe$3.60/mo$43.20 for 12 months
A1-2team wiki with PostgreSQL search1 vCPU, 2 GB RAM, 50 GB NVMe$7.20/mo$43.20 for 6 months

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.