This guide will take you through steps to Install Dokuwiki behind nginx and letsencrypt on CentOS 7 Linux. But before we can do any installation, I’ll assume you have a newly provisioned CentOS 7 Linux server that you need to do some prereqs prior to setting up Dokuwiki.

Set server hostname

sudo hostnamectl set-hostname

Step 1: Update system and install Development tools

It is recommended to ensure all system packages are updated:

sudo yum -y update
sudo yum -y install git vim bash-completion curl wget unzip tar

Reboot your server for new changes like kernel to take effect:

sudo reboot

Step 2: Add epel and Remi repository for php 7.x

Once the server is up after a reboot, proceed to install all required php modules including php fpm used by Nginx. But first, you’ll need to add epel and remi repositories to the system:

sudo yum install epel-release yum-utils
sudo yum install
sudo yum makecache fast
sudo yum-config-manager --disable remi-php54
sudo yum-config-manager --enable remi-php72

Step 3: Install php 7 and nginx

Install php 7 by running the following commands:

sudo yum -y install php-cli php-fpm php-mysql php-zip php-ldap php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath

This should provide all the modules required by DokuWiki. Check your php version:

# php -v
PHP 7.2.10 (cli) (built: Sep 11 2018 11:22:20) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Step 4: Download Dokuwiki and extract it to your its Document root

Before downloading any version of DokuWiki, check Github releases page for the latest stable release. As of this writing, the latest stable release is release_stable_2020-07-29

export RELEASE="2020-07-29"

Extract DokuWiki archive using tar

tar xvf release_stable_${RELEASE}.tar.gz
sudo mkdir -p /var/www/html/ 
sudo mv dokuwiki-release_stable_${RELEASE} /var/www/html/dokuwiki

Change ownership of /var/www/html/dokuwiki to www-data user and group.

sudo chown -R nginx:nginx /var/www/html/dokuwiki/

Step 5: Install Letsencrypt and request for a new certificate

We will request for SSL certificate using certbot-auto. Install it by downloading the binary package and placing it inside /use/local/bin directory:

sudo wget -P /usr/local/bin
sudo chmod a+x /usr/local/bin/certbot-auto

Once downloaded, open http and https ports on the firewall if you have an active firewall service:

sudo firewall-cmd --add-service {http,https} --permanent
sudo chmod a+x /usr/local/bin/certbot-auto

Then obtain a certificate:

export DOMAIN=""
export EMAIL="youremailaddress"
certbot-auto certonly --standalone -d $DOMAIN --preferred-challenges http --agree-tos -n -m $EMAIL --keep-until-expiring

Enable nginx service to start on boot:

sudo systemctl enable nginx

Step 6: Configure Nginx

Create new configuration file:

sudo vim /etc/nginx/conf.d/dokuwiki.conf

Add the following content, modify to suit you use case. Replace with your domain name.

server {

listen 443 ssl;
 root /var/www/html/;

access_log /var/log/nginx/dokuwiki.access.log;
 error_log /var/log/nginx/dokuwiki.error.log;

ssl on;
 ssl_certificate /etc/letsencrypt/live/;
 ssl_certificate_key /etc/letsencrypt/live/;
 ssl_session_timeout 5m;
 ssl_ciphers 'AES128+EECDH:AES128+EDH:!aNULL';
 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
 ssl_prefer_server_ciphers on;

index index.html index.php doku.php;

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 last;

location ~ /(data|conf|bin|inc)/ {
 deny all;

location ~* \.(css|js|gif|jpe?g|png)$ {
 expires 1M;
 add_header Pragma public;
 add_header Cache-Control "public, must-revalidate, proxy-revalidate";

location ~ \.php$ {
 fastcgi_split_path_info ^(.+\.php)(/.+)$;
 fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
 fastcgi_index index.php;
 include fastcgi_params;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 fastcgi_intercept_errors off;
 fastcgi_buffer_size 16k;
 fastcgi_buffers 4 16k;

location ~ /\.ht {
 deny all;

server { 
 listen 80;
 add_header Strict-Transport-Security max-age=2592000;
 rewrite ^$request_uri? permanent;

Step 7: Configure php-fpm and start nginx/php-fpm

Now that we have nginx configured, let’s also configure php-fpm. Open the file:

sudo vim /etc/php-fpm.d/www.conf

Configure below parameters on the file as specified:

user = nginx
group = nginx
listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nginx = nginx
listen.mode = 0660
Start and enable nginx,php-fpm
sudo systemctl start php-fpm nginx
sudo systemctl enable php-fpm

Step 8: Configure DokuWiki on CentOS 7

Start DokuWiki configuration by opening the link: https://wiki.mydomain/install.php, you will get the installation page like below:
install dokuwiki ubuntu 18.04 01

Provide admin user details, under,Initial ACL policy choose your policy from one of:

  • Open Wiki – Open for everyone
  • Public Wiki – read for all, uploads and edits for registered users
  • Closed Wiki – Access only for registered users

Check whether you want to Allow users to register themselves

When done, click Save. The wiki page should now be ready.

install dokuwiki ubuntu 18.04 02

Click “your new DokuWiki” to get to DokuWiki home page.

Step 7: Adding users to DokuWiki

If you had selected “Closed Wiki | Public” as your ACL policy, you will be given login page for edits. Log in with admin account you created earlier to start adding other users to the system:

install dokuwiki ubuntu 18.04 login

Click “Admin” icon at the top of the page, this will take you to admin page:

dokuwiki add user acl

Click on “User Manager” to get add user page:

dokuwiki add users 02

Add User details and click “Add” button. After adding a user, you can assign ACL on “Access Control List Management” page.

dokuwiki add user acl

Select from given Permissions.

dokuwiki user permissions

Related Articles

How to install and configure DokuWiki on CentOS 7

Install DokuWiki on Ubuntu with Let’s Encrypt SSL

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here