Table of Contents
Installing Dokuwiki on Ubuntu 18.04 with Nginx
This will be largely similair to the general Ubuntu guide so check there as well.
Requirements
Install PHP and Nginx
# you can install other versions through a PPA, # but 7.2 works and is in the default repositories # php7.x-fpm is required to use fpm with nginx sudo apt install php7.2 php7.2-xml php7.2-fpm nginx
Download & Extract Dokuwiki tar.gz
Use wget
to download the compressed DokuWiki.
Note: URL current as of 2020-03-03. Check the downloads page for current version.
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
Move the downloaded dokuwiki-stable.tgz
to your web root. If you're unsure use var/www
sudo mv dokuwiki-stable.tgz /var/www/
Extract DokuWiki
cd /var/www sudo tar xf dokuwiki-stable.tgz # this will extract to a directory named dokuwiki-2018-04-22b # I reccomened renaming that to dokuwiki with the following: sudo mv dokuwiki-2018-04-22b dokuwiki
Configure Nginx
If you're not hosting anything else you can edit the default /etc/nginx/sites-enabled/000-default
server { listen 80; root /var/www/dokuwiki; index index.php index.html index.html; 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.2-fpm.sock matches your version include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
Set permissions
Ensure dokuwiki is owned by www-data:www-data
, the default Nginx user.
sudo chown -R www-data:www-data /var/www/dokuwiki # todo chmod for datadir, I believe it should be 644
Run Install Script
At this point you should be able to navigate to localhost
or your server's IP in a browser to run the install script.
Follow the on-screen directions to configure your DokuWiki
Delete Install Script
While not mandatory, once you've completed the installation you have no reason to keep the file around.
sudo rm /var/www/dokuwiki/install.php
Enjoy your Wiki!
If you're reading this, you should now have a working DokuWiki to begin using.