This instance of DokuWiki is installed along with NGINX on Fedora Server 29. This page describes the installation process for future references.
dnf install nginx php-fpm php-json systemctl start nginx systemctl enable php-fpm systemctl enable nginx
firewall-cmd --list-all firewall-cmd --permanent --remove-service=cockpit firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https firewall-cmd --reload
vim /etc/nginx/nginx.conf root /var/www/html; systemctl reload nginx
The RPM package sets the user and group to apache
. I want it to run under nginx
instead.
vim /etc/php-fpm.d/www.conf user nginx group nginx systemctl reload php-fpm
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz tar xf dokuwiki-stable.tgz cd /var/www/html cp -r ~/dokuwiki-2018-04-22b/ wiki chown nginx:nginx -R wiki
Fedora has SELinux enabled by default, which prevents DokuWiki from modifying files under /var/www
.
I didn't go this route because it looks dangerous.
sestatus getenforce setenforce 0
dnf install policycoreutils-python-utils semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/wiki/.*' cd wiki ls -Z restorecon -v -R .
I didn't test this but it should work.
semanage permissive -a httpd_t
DokuWiki installation process needs password inputs, so installing HTTPS certificates MUST come before that.
dnf install certbot-nginx certbot --nginx
crontab -e 0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew crontab -l
Before going through install.php
, I configured NGINX as follows.
vim /etc/nginx/nginx.conf http { types_hash_max_size 4096; server { location = / { return 302 https://$host/wiki/; } location ~ /(conf|bin|inc)/ { deny all; } location ~ /data/ { internal; } } } systemctl reload nginx
After going through install.php
, remove it.
I followed https://www.dokuwiki.org/rewrite#nginx and the following options were needed.
vim conf/local.php $conf['basedir'] = '/wiki/'; $conf['userewrite'] = '1'; $conf['useslash'] = 1; vim /etc/nginx/nginx.conf http { server { location /wiki/ { index doku.php; try_files $uri $uri/ @dokuwiki; } location @dokuwiki { rewrite ^/wiki/_media/(.*) /wiki/lib/exe/fetch.php?media=$1 last; rewrite ^/wiki/_detail/(.*) /wiki/lib/exe/detail.php?media=$1 last; rewrite ^/wiki/_export/([^/]+)/(.*) /wiki/doku.php?do=export_$1&id=$2 last; rewrite ^/wiki/(?!lib/)(.*) /wiki/doku.php?id=$1&$args last; } } }