(Last Updated On: July 1, 2018)

DokuWiki is a free and open source wiki software written in PHP. DokuWiki is highly versatile and doesn’t require a database since it works on plain text files. It has a syntax similar to the one used by MediaWiki. This guide will cover the steps to Install DokuWiki on Ubuntu 18.04 with Nginx and Letsencrypt SSL encryption.

I had written another article a while back but it was for CentOS 7 server –> Install Dokuwiki behind nginx and letsencrypt on Linux. This is dedicated to Ubuntu 18.04.

DokuWiki on Ubuntu 18.04 Prerequisites:

  • Updated system
  • PHP and php-fpm
  • Nginx or Apache web server
  • certbot-auto for requesting a Certbot certificate

Let’s kick off by making sure all software requirements are installed.

Step 1: Update system packages

Make sure your apt index and all software packages are updated.

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
$ sudo reboot

After rebooting the system, set system hostname and proceed to install php and all required modules:

$ sudo hostnamectl set-hostname wiki.computingforgeks.com

Step 2: Install php and required modules

We now need to install php and some php modules required by DokuWiki. Run the following commands to get everything installed.

$ sudo apt-get -y install php php-curl php-apcu php-fpm php-bcmath \
php-gd php-intl php-pear php-imap php-memcache libapache2-mod-php \
php-pspell php-recode php-tidy php-xmlrpc \
php-mbstring php-gettext php-gmp php-json php-xml php-common

By default, php version 7.2 will be installed on Ubuntu 18.04. You can check version installed using the command php -v

[email protected]:~# php -v
PHP 7.2.5-0ubuntu0.18.04.1 (cli) (built: May 9 2018 17:21:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.5-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

Php socket is located on,/var/run/php/php7.2-fpm.sock, the configuration for this is./etc/php/7.2/fpm/pool.d/www.conf

php-fpm service will be started by default, and its name is php7.2-fpm.service

To get a list of php extensions installed on your system, use php -m command:

[email protected]:~# php -m

Step 3: Install Nginx and certbot-auto

Let’s install nginx webserver and certbot-auto which we’ll later use to get a certificate for DokuWiki site.

$ sudo apt-get update
$ sudo apt-get install wget nginx
$ wget https://dl.eff.org/certbot-auto
$ chmod +x certbot-auto
$ sudo mv certbot-auto /usr/local/bin/certbot-auto

Step 4: Download and Install DokuWiki

Before downloading any version of DokuWiki, check Github releases page for the latest stable release. As of this writing, the latest stable release is release_stable_2018-04-22a

$ export RELEASE="2018-04-22a"
$ wget https://github.com/splitbrain/dokuwiki/archive/release_stable_${RELEASE}.tar.gz

Extract DokuWiki archive using tar

$ tar xvf release_stable_${RELEASE}.tar.gz
$ sudo mv dokuwiki-release_stable_${RELEASE} /var/www/html/dokuwiki

Change ownership of /var/www/html/dokuwiki to www-data user and group.

$ sudo chown -R www-data:www-data /var/www/html/dokuwiki/

Step 5: Request for Letsencrypt SSL Certificate

Stop nginx since certbot-auto will bind to port 80

$ sudo systemctl stop nginx

Then request for a certificate:

# export DOMAIN='wiki.computingforgeeks.com'
# export EMAIL="[email protected]"
# certbot-auto certonly --standalone -d $DOMAIN \
--preferred-challenges http --agree-tos -n -m $EMAIL \

If successful, certbot will give you a successful message:

[email protected]:~# certbot-auto certonly --standalone -d $DOMAIN --preferred-challenges http --agree-tos -n -m $EMAIL --keep-until-expiring
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for wiki.computingforgeeks.com
Waiting for verification...
Cleaning up challenges

 - Congratulations! Your certificate and chain have been saved at:
   Your key file has been saved at:
   Your cert will expire on 2018-09-29. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again. To non-interactively renew *all* of your certificates, run
   "certbot-auto renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Step 5: Configure Nginx with SSL

systemctl enable nginx
vim /etc/nginx/conf.d/dokuwiki.conf

Add the following content, modify to suit your use case. Replace wiki.mydomain.com with your domain name.

server {

listen 443 ssl;
 server_name wiki.mydomain.com;
 root /var/www/html/dokuwiki/;

 access_log /var/log/nginx/dokuwiki.access.log;
 error_log /var/log/nginx/dokuwiki.error.log;
 ssl on;
 ssl_certificate /etc/letsencrypt/live/wiki.mydomain.com/fullchain.pem;
 ssl_certificate_key /etc/letsencrypt/live/wiki.mydomain.com/privkey.pem;
 ssl_session_timeout 5m;
 ssl_ciphers 'AES128+EECDH:AES128+EDH:!aNULL';
 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
 ssl_prefer_server_ciphers on;

 index index.html index.php doku.php;

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 last;

location ~ /(data|conf|bin|inc)/ {
 deny all;

location ~* \.(css|js|gif|jpe?g|png)$ {
 expires 1M;
 add_header Pragma public;
 add_header Cache-Control "public, must-revalidate, proxy-revalidate";

location ~ \.php$ {
 fastcgi_split_path_info ^(.+\.php)(/.+)$;
 fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
 fastcgi_index index.php;
 include fastcgi_params;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 fastcgi_intercept_errors off;
 fastcgi_buffer_size 16k;
 fastcgi_buffers 4 16k;

location ~ /\.ht {
 deny all;

# Redirect http to https
server { 
 listen 80;
 server_name wiki.mydomain.com;
 add_header Strict-Transport-Security max-age=2592000;
 rewrite ^ https://wiki.mydomain.com$request_uri? permanent;

Replace all existence of wiki.mydomain.com with your wiki domain.

Check nginx syntax:

[email protected]:~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

If no error, restart nginx and php-fpm

$ sudo systemctl restart php-fpm nginx
$ sudo systemctl status php7.2-fpm.service nginx

Step 6: Configure DokuWiki on Ubuntu 18.04

Start DokuWiki configuration by opening the link: https://wiki.mydomain/install.php, you will get installation page like below:

Provide admin user details, under,Initial ACL policy choose your policy from one of:

  • Open Wiki – Open for everyone
  • Public Wiki – read for all, uploads and edits for registered users
  • Closed Wiki – Access only for registered users

Check whether you want to Allow users to register themselves

When done, click Save. The wiki page should now be ready.

Click “your new DokuWiki” to get to DokuWiki home page.

Step 7: Adding users to DokuWiki

If you had selected “Closed Wiki | Public” as your ACL policy, you will be given login page for edits. Log in with admin account you created earlier to start adding other users to the system:

Click “Admin” icon at the top of the page, this will take you to admin page:

Click on “User Manager” to get add user page:

Add User details and click “Add” button. After adding a user, you can assign ACL on “Access Control List Management” page.

Select from given Permissions.

In our next Wiki guides, I’ll cover how to install plugins on DokuWiki to extend its functionalities.