Table of Contents
Installing DokuWiki on Ubuntu 24.04 with Nginx and PHP 8.3
Requirements
Download & Extract DokuWiki
Configure Nginx
Set Permissions
Run Install Script
Delete Install Script
Installing DokuWiki on Ubuntu 24.04 with Nginx and PHP 8.3
This guide covers the installation of DokuWiki on Ubuntu Server 24.04 (Noble Numbat) using Nginx and PHP-FPM 8.3. Requirements
Install PHP 8.3 and Nginx.
# Ubuntu 24.04 includes PHP 8.3 by default. # We specify php8.3-fpm specifically to avoid pulling in Apache dependencies. sudo apt update sudo apt install nginx php8.3-fpm php8.3-cli php8.3-common php8.3-xml php8.3-mbstring php8.3-zip php8.3-gd
Download & Extract DokuWiki
Use wget to download the latest stable release.
# This URL always points to the most recent stable release wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
Move and extract the archive to your web root (/var/www).
sudo mv dokuwiki-stable.tgz /var/www/ cd /var/www sudo tar xzf dokuwiki-stable.tgz # Rename the extracted folder (e.g., dokuwiki-2024-02-06a) to just 'dokuwiki' sudo mv dokuwiki-*/ dokuwiki
Configure Nginx
There are two ways to handle the configuration depending on whether you want DokuWiki to be your primary site or a sub-page.
Option A: Dedicated Site (Recommended) This makes DokuWiki the primary site (e.g., http://your-ip/). Create a new file:
sudo nano /etc/nginx/sites-available/dokuwiki
Paste the following into the file:
/etc/nginx/sites-available/dokuwiki
server {
listen 80;
server_name _;
root /var/www/dokuwiki;
index index.php index.html;
# Security: Block access to sensitive DokuWiki directories
location ~ /(data|conf|bin|inc|vendor)/ {
deny all;
}
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$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Enable and restart:
sudo ln -s /etc/nginx/sites-available/dokuwiki /etc/nginx/sites-enabled/ sudo rm /etc/nginx/sites-enabled/default sudo nginx -t && sudo systemctl restart nginx
Option B: Subdirectory Site Use this if you want the wiki at http://your-ip/dokuwiki alongside other content. Edit /etc/nginx/sites-available/default:
/etc/nginx/sites-available/default
server {
listen 80 default_server;
root /var/www/html;
index index.php index.html;
location /dokuwiki {
alias /var/www/dokuwiki/;
index index.php index.html;
try_files $uri $uri/ @dokuwiki;
}
location ~ ^/dokuwiki/(data|conf|bin|inc|vendor)/ {
deny all;
}
location @dokuwiki {
rewrite ^/dokuwiki/_media/(.*) /dokuwiki/lib/exe/fetch.php?media=$1 last;
rewrite ^/dokuwiki/_detail/(.*) /dokuwiki/lib/exe/detail.php?media=$1 last;
rewrite ^/dokuwiki/_export/([^/]+)/(.*) /dokuwiki/doku.php?do=export_$1&id=$2 last;
rewrite ^/dokuwiki/(.*) /dokuwiki/doku.php?id=$1&$args last;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
}
}
Set Permissions
sudo chown -R www-data:www-data /var/www/dokuwiki sudo find /var/www/dokuwiki -type d -exec chmod 755 {} \; sudo find /var/www/dokuwiki -type f -exec chmod 644 {} \;
Run Install Script
Navigate to: http://your-server-ip/install.php (or /dokuwiki/install.php if using Option B). Delete Install Script
sudo rm /var/www/dokuwiki/install.php
install/ubuntu_24.04_nginx.txt ยท Last modified: 2026-03-09 07:14 by saggi Page Tools
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 Imprint Global DokuWiki Links
Download Wiki Forum IRC Bugs Translate Git XRef Code Search