I challenge anyone to setup Dokuwiki with Nginx and add a commericial SSL domain

Posted September 14, 2021 67 views
NginxUbuntu 20.04

Tried several times from scratch. I can only get it to work without the SSL which is pointless IMO.

I challenge someone to do this from scratch:
Setup Nginx with PHP and install Dokuwiki
Attach a commericial SSL Domain to it.
Then explain to me what wizardry you used to get it to work, in detail.

I don’t think it can be done, hours of guides have not helped.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


I’ve tested this and it worked well. I will try to cover the whole process assuming that you already have the commercial SSL certificate in PEM format on hand.

Note that you would need the following files: the SSL Certificate, the Private Key, and the CA Bundle in PEM format.

Install LEMP

The first thing that you would need to do is install PHP and Nginx, you could do that by following the steps here:

Or deploy it with 1-Click by using this image here:

Once you have that in place, the next thing that you need to do is to SSH to the Droplet and install Dokuwiki.

Install Dokuwiki

Once you SSH to your LEMP Droplet, download the Dokuwiki files:


Move the file to the /var/www folder:

sudo mv dokuwiki-stable.tgz /var/www/

Extract the archive:

sudo tar xf dokuwiki-stable.tgz

Rename the folder to match either your domain name or set it to dokuwiki:

sudo mv dokuwiki-2020-07-29 dokuwiki

Note that the dokuwiki-2020-07-29 might be different in the future, so make sure to change it with the actual name of the directory.

Finally, change the ownership of the files:

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

With that, the Dokuwiki files should all be sorted. Next, we need to focus on the Nginx configuration.

Prepare your SSL certificate files

Let’s start by adding the SSL certificate to your server. With your favorite text editor open the following file:

nano /etc/ssl/your_domain_name.pem

And in there add your SSL certificate followed by the certificate bundle (the CA) right after that. This file basically should include the full chain.

Right after that, save the file and exit.

Then do the same for your private key. Again with your favorite text editor open the following file:

nano /etc/ssl/your_domain_name.key

And in there add the content of your private key. Save the file and exit.

Configure Nginx and install SSL

First create a new config file for your Nginx server block:

sudo nano /etc/nginx/sites-available/your_domain

And add the following content:

server {
    listen 80;
    listen [::]:80;
    return 301$request_uri;

server {
    listen 443 ssl;
    root /var/www/dokuwiki;
    index index.php index.html index.html;

    ssl_certificate    /etc/ssl/your_domain_name.pem;
    ssl_certificate_key    /etc/ssl/your_domain_name.key;

    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$ {
        # Caution: be sure the php7.4-fpm.sock matches your version
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;

Make sure to change the part with your actual domain

After that enable that server block:

ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/your_domain

For more information on Nginx server blocks, check out this tutorial here:

Then once you’ve added the new configuration, run an Nginx config test:

sudo nginx -t

And finally, if you get Syntax OK restart Nginx:

sudo systemctl restart nginx

Complete Dokuwiki install

Then with that then you are ready to complete the installation by visiting:

If you get the following error:

PHP function xml_parser_create is not available

Make sure to install the PHP XML extension:

sudo apt update -y
sudo apt install php-xml

And then refresh the page in your browser again and finish the installation.

After completing the installation delete the install.php from the /var/www/dokuwiki directory.


Enjoy your Wiki secured with a commercial SSL!

Hope that this helps!

by Justin Ellingwood
When using the Nginx web server, server blocks (similar to the virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain off of a single server. In this guide, we'll discuss how to configure server blocks in Nginx on an Ubuntu 16.04 server.