DokuWiki

It's better when it's simple

User Tools

Site Tools


install:ubuntu:ubuntu_18.04_nginx

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.

http://localhost/install.php

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.

install/ubuntu/ubuntu_18.04_nginx.txt · Last modified: 2024-02-07 06:40 by 23.108.96.79

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki