Introduction
DokuWiki is a simple, lightweight wiki platform that doesn't require a database. It's ideal for creating documentation or collaborative websites. This tutorial will guide you through the process of installing DokuWiki with Nginx as a web server and securing it with Let's Encrypt SSL on Alma Linux.
Prerequisites
Before you begin, ensure you have:
- An Alma Linux server
- SSH access to the server (optional)
- Domain name pointed to your server's IP address
Step 1: Install Nginx
Install Nginx from the default Alma Linux repositories:
sudo dnf install -y nginx
Step 2: Install Certbot
Install Certbot to obtain Let's Encrypt SSL certificates:
sudo dnf install -y certbot python3-certbot-nginx
Step 3: Obtain SSL Certificate
Run Certbot to obtain a free SSL certificate:
sudo certbot --nginx -d your_domain
Follow the prompts to generate the SSL certificate.
Step 4: Install DokuWiki
Download the latest version of DokuWiki:
cd /tmp
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
Extract the archive and move it to the Nginx document root:
sudo tar -xzvf dokuwiki-stable.tgz -C /usr/share/nginx/
sudo mv /usr/share/nginx/dokuwiki-* /usr/share/nginx/dokuwiki
Step 5: Configure Nginx
Create a new Nginx server block configuration file for DokuWiki:
sudo nano /etc/nginx/conf.d/dokuwiki.conf
Add the following configuration:
server {
listen 80;
server_name your_domain;
root /usr/share/nginx/dokuwiki;
index 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&$args last;
}
location ~ /(data|conf|bin|inc)/ {
deny all;
}
location ~ /\.ht {
deny all;
}
}
Save and close the file.
Step 6: Test Nginx Configuration
Test the Nginx configuration for any syntax errors:
sudo nginx -t
If the test is successful, restart Nginx:
sudo systemctl restart nginx
Step 7: Access DokuWiki
Open a web browser and navigate to:
https://your_domain
You should see the DokuWiki installation page.
Conclusion
Congratulations! You have successfully installed DokuWiki with Nginx and Let's Encrypt SSL on Alma Linux. You can now use DokuWiki to create and manage documentation or collaborative websites.