Overview
DokuWiki
is a historic open-source wiki engine first released in 2004. It operates based on PHP and functions without a database, using only the file system, making it lightweight and easy to manage for anyone. This article outlines the steps to install DokuWiki on an Ubuntu operating system.
Prerequisites
- Your own internet domain
- A remote server with Ubuntu operating system installed and accessible over the internet
Installing NGINX
NGINX
enables the server to provide web services.
$ sudo apt-get update && sudo apt-get upgrade -y
$ sudo apt-get install nginx -y
$ sudo systemctl enable nginx
$ sudo chmod -R 777 /var/www/html
$ sudo systemctl start nginx
Installing PHP-FPM
PHP-FPM
enables NGINX to execute PHP source code. Install it as follows:
$ sudo apt-get install ca-certificates apt-transport-https software-properties-common -y
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install php8.3-fpm php8.3-gd php8.3-xml -y
$ sudo systemctl enable php8.3-fpm
$ sudo systemctl start php8.3-fpm
$ sudo systemctl restart nginx
Installing Certbot
Certbot
automatically facilitates the installation of free SSL certificates from Let's Encrypt. Once installed, it will serve requests to your domain over HTTPS only.
$ sudo snap install core; sudo snap refresh core
$ sudo snap install --classic certbot
$ sudo ln -s /snap/bin/certbot /usr/bin/certbot
$ sudo certbot --nginx -d {your-domain}
$ sudo systemctl status snap.certbot.renew.service
NGINX Configuration
- Add the following configuration for PHP-FPM and DokuWiki in the NGINX environment configuration file.
$ sudo nano /etc/nginx/sites-available/default
server {
server_name {your-domain};
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location ~ /(data|conf|bin|inc|vendor)/ {
deny all;
}
listen [::]:443 ssl ipv6only=on;
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/{your-domain}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{your-domain}/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
server_name {your-domain};
if ($host = {your-domain}) {
return 301 https://$host$request_uri;
}
listen 80;
listen [::]:80;
return 404;
}
Firewall Configuration
- On the remote server, allow only SSH and NGINX service ports through the firewall and start the service.
$ sudo ufw allow ssh
$ sudo ufw allow 'Nginx Full'
$ sudo ufw enable
$ sudo ufw start
Installing DokuWiki
- To install
DokuWiki
, navigate to download.dokuwiki.org in your browser, select the installation options that suit your preferences, and click the Download button to obtain the .tgz file URL. Use the acquired URL to install DokuWiki as follows:
$ cd /var/www/html
$ wget {your-dokuwiki-tgz-download-url}
$ tar xzvf {your-dokuwiki-tgz-filename}
$ sudo chown -R www-data:www-data /var/www/html/dokuwiki
$ nano /var/www/html/robots.txt
User-agent: *
Disallow: /
Disallow: /dokuwiki/
- The installation process through the terminal console is now complete. To finish the installation, access https://{your-domain}/dokuwiki/install.php in your browser and follow the instructions.
Regenerating DokuWiki Document Cache
DokuWiki
provides fast search functionality through pre-generated document caches. If you encounter issues with the cache function for various reasons, you can reset and regenerate the document cache as follows:
$ cd /var/www/html/dokuwiki
$ sudo rm -rf data/cache/*
$ sudo -u www-data php bin/indexer.php -c
Recommended Plugins
References