DokuWiki is a lightweight wiki that stores everything in plain text files, so there’s no database to install, tune or back up separately. It’s fast, secure by design, has fine-grained access control lists, and is perfect for documentation, team notes, homelab runbooks and small knowledge bases. A tiny VPS runs it comfortably.

Comparing wikis? See MediaWiki, Wiki.js and BookStack.

Why no database matters

  • Simple backups: copy a directory.
  • Easy migration: move the folder to another server.
  • Readable data: pages are text files under data/pages/, so you can grep them or version them in Git.
  • Low resources: PHP alone.

The trade-off: very large wikis (hundreds of thousands of pages) or heavy concurrent editing are better served by database-backed wikis.

Requirements

Nginx (or Apache) with PHP-FPM, and the PHP extensions gd, mbstring, xml, json and intl:

sudo apt install nginx php-fpm php-gd php-mbstring php-xml php-intl

See Nginx with PHP-FPM.

Install

cd /tmp
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
sudo mkdir -p /var/www/dokuwiki
sudo tar xzf dokuwiki-stable.tgz -C /var/www/dokuwiki --strip-components=1
sudo chown -R www-data:www-data /var/www/dokuwiki

Nginx configuration

The key point is denying web access to the data, config and internal directories:

server {
    server_name wiki.example.com;
    root /var/www/dokuwiki;
    index doku.php;
    client_max_body_size 20M;

    location ~ /(conf/|bin/|inc/|vendor/|install.php) { deny all; }
    location ~ ^/data/ { internal; }
    location ~ /\.ht { deny all; }

    location / { try_files $uri $uri/ @dokuwiki; }
    location @dokuwiki {
        rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
        rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
        rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
        rewrite ^/(.*) /doku.php?id=$1&$args last;
    }

    location ~ \.php$ {
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    }
}

Temporarily allow install.php (remove it from the deny line), run the installer, then re-block it, or simply delete the file after installation. Add HTTPS with Certbot. See Let’s Encrypt.

Run the installer

Open https://wiki.example.com/install.php:

  • wiki name and superuser account;
  • Enable ACL (recommended);
  • initial ACL policy: open wiki, public wiki (read for all, edit for users), or closed wiki (only registered users can read);
  • licence for content.

Then delete the installer:

sudo rm /var/www/dokuwiki/install.php

Test that sensitive files are protected. This should return 403 or 404, never the file’s contents:

curl -I https://wiki.example.com/data/pages/wiki/dokuwiki.txt
curl -I https://wiki.example.com/conf/users.auth.php

Nice URLs

In Admin → Configuration Settings: set Use nice URLs to “.htaccess” (works with the Nginx rewrites above), and enable “Use slash as namespace separator” for URLs like /projects/website/deploy.

Users and ACLs

  • Admin → User Manager: create users and groups (or use LDAP or OAuth via plugins).
  • Admin → Access Control List: permissions per namespace and page, e.g. @ops can edit runbooks:*, @ALL has no access to internal:*.
  • Disable self-registration if the wiki is private (Configuration → disableactions: register).

Plugins and templates

The Extension Manager (Admin) installs plugins and templates from the official repository. Useful ones: Bootstrap3 template, Wrap, Move (rename pages and namespaces), Tag, Upgrade, BackupTool, Code prettifiers and OAuth. Keep plugins few and maintained.

Backups

Everything lives in a few directories:

rsync -a /var/www/dokuwiki/data/ /backups/dokuwiki/data/
rsync -a /var/www/dokuwiki/conf/ /backups/dokuwiki/conf/
rsync -a /var/www/dokuwiki/lib/plugins/ /backups/dokuwiki/plugins/

data/pages, data/media, data/meta and data/attic (revisions) matter most. data/cache can be skipped. See rsync and backup strategy.

Upgrades

Use the Upgrade plugin (one click, after a backup), or manually extract the new release over the old one (it doesn’t overwrite data/ or your config files). Then delete the files listed in data/deleted.files. See updating self-hosted apps.

Quick reference

Item Location
Pages (text) data/pages/
Uploads data/media/
Revisions data/attic/
Config and ACLs conf/ (local.php, acl.auth.php, users.auth.php)
Must be web-blocked data/, conf/, bin/, inc/
Installer install.php (delete after setup)

Related: Nginx 403 Forbidden and PHP versions.

  • Self-Hosting
  • Wiki
  • PHP