Table of Contents

Dokuwiki

Lightweight no database php wiki

Syntax

Pages are automatically treated as markdown with the commonmark plugin.

There is some special dokuwiki syntax.

Notes (plugin)


This is a warning note.

This is a more important informational note.

This is a tip-like note.

This is a tip-like note.

Debian install

Debian version is old and imposes a different dir structure
This setups assumes nginx as a webserver.

  1. Install dependencies
    apt install php8.4-fpm
    apt install php php-fpm php-xml php-json php-mbstring php-zip php-intl php-gd php-sqlite3
  2. Download dokuwiki and move it somewehere useful
    wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
    mkdir -p /var/www/html/dokuwiki
    tar xzvf dokuwiki-stable.tgz -C /var/www/html/
  3. Change permissions for webserver
    chown -R www-data:www-data /var/www/html/dokuwiki
  4. Configure webserver
server {
        server_name wiki.ctq.ro;
 
        listen 443 ssl; # managed by Certbot
        listen [::]:443 ssl ipv6only=on; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/ctq.ro/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/ctq.ro/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
 
        client_max_body_size 50M;
        client_body_buffer_size 128k;
 
        root /var/www/html/dokuwiki;
        index doku.php;
 
        location / { try_files $uri $uri/ @dokuwiki; }
 
        # tell browser to cache images
        location ~ ^/lib.*\.(js|css|gif|png|ico|jpg|jpeg)$ {
                expires 365d;
        }
 
        # orion config set
        #include orion/orion.conf;
 
	# disable install page
	location ~ /(install.php) { deny all; }
 
        # hide restricted folders
        location ~ /(data|conf|bin|inc)/ {
                return 404;
        }
 
        # stop whining about favicon
        location = /favicon.ico {
                access_log off;
                log_not_found off;
                expires 365d;
        }
 
        location @dokuwiki {
        # rewrites "doku.php/" out of the URLs if you set the userwrite setting to .htaccess in dokuwiki config
                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 $uri/ /doku.php;
 
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param REDIRECT_STATUS 200;
                fastcgi_pass unix:/var/run/php/php-fpm.sock;
        }
}
  1. Restart webserver and php8.4-fpm
  2. Configure dokuwiki at http://localhost/dokuwiki/install.php
  3. Deny access to / delete install.php

See also

The dokuwiki wiki for debian at https://www.dokuwiki.org/install:debian