sudo apt install nginx php7.0 php7.0-fpm php7.0-mbstring php7.0-xml
unp docuwiki-stable.tgz
mv docuwiki-stable/* .
mv docuwiki-stable/.htaccess.dist .
rmdir docuwiki-stable/
chown -R www-data:www-data ../

Using the following Nginx configuration file (with the install.php line commented out for installation.

server {
    listen               80;
    listen                   [::]:80;
    # Redirect non-https traffic to https
    if ($scheme != "https") {
        return 301 https://$host$request_uri;
    } # managed by Certbot
server {
    listen [::]:443 ssl;
    listen 443 ssl;
    # Maximum file upload size is 4MB - change accordingly if needed
    client_max_body_size 100M;
    client_body_buffer_size 128k;
    root /home/nginx/www/;
    index index.php doku.php;
    #Remember to comment the below out when you're installing, and uncomment it when done.
    location ~ /(data/|conf/|bin/|inc/|install.php) { deny all; }
#   Uncomment this prevents images being displayed ! 
#    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
#        expires 31536000s;
#        add_header Pragma "public";
#        add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
#        log_not_found off;
#    }
    location / { try_files $uri $uri/ @dokuwiki; }
    location @dokuwiki {
        # rewrites "doku.php/" out of the URLs if you set the userewrite setting to .htaccess in dokuwiki config page
        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/php7.0-fpm.sock;
ssl_certificate /etc/letsencrypt/live/; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/; # managed by Certbot


sudo service php7.0-fpm reload && sudo service nginx reload

The go to and install DokuWiki. Then uncomment the install.php line back out and do

sudo service nginx reload