Introduction
DokuWiki is a simple-to-use and highly versatile open-source wiki software that doesn't require a database. This tutorial will guide you through the process of installing DokuWiki with Nginx as the web server and Let's Encrypt SSL certificate for secure connections on FreeBSD 12.
Prerequisites
Before you begin, ensure you have:
- A FreeBSD 12 server or virtual machine
- SSH access to the server
- Root or sudo privileges
- A domain name pointed to your server's IP address
Step 1: Install Nginx
Install Nginx web server:
sudo pkg update
sudo pkg install -y nginx
Step 2: Install Certbot
Install Certbot for Let's Encrypt:
sudo pkg install -y py39-certbot py39-certbot-nginx
Step 3: Obtain SSL Certificate
Obtain an SSL certificate for your domain:
sudo certbot --nginx -d your_domain
Follow the on-screen prompts to obtain and install the SSL certificate.
Step 4: Install DokuWiki
Install DokuWiki:
sudo pkg install -y dokuwiki
Step 5: Configure Nginx for DokuWiki
Create a new Nginx server block configuration file for DokuWiki:
sudo nano /usr/local/etc/nginx/conf.d/dokuwiki.conf
Add the following configuration:
server {
listen 80;
server_name your_domain;
root /usr/local/www/dokuwiki;
index doku.php;
location / {
try_files $uri $uri/ @dokuwiki;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
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;
}
}
Replace your_domain
with your actual domain name.
Save the file and exit the text editor.
Step 6: Configure PHP-FPM
Edit the PHP-FPM configuration file:
sudo nano /usr/local/etc/php-fpm.d/www.conf
Uncomment the following lines to enable PHP-FPM socket:
listen = /var/run/php-fpm.sock
listen.owner = www
listen.group = www
Save the file and exit the text editor.
Restart PHP-FPM service:
sudo service php-fpm restart
Step 7: Restart Nginx
Restart Nginx to apply the changes:
sudo service nginx restart
Step 8: Complete DokuWiki Installation
Open a web browser and navigate to your DokuWiki installation using your domain name:
http://your_domain/install.php
Follow the on-screen instructions to complete the DokuWiki installation.
Step 9: Remove Install Script
Remove the DokuWiki install script for security:
sudo rm /usr/local/www/dokuwiki/install.php
Step 10: Access DokuWiki
Open a web browser and navigate to your DokuWiki installation using your domain name:
https://your_domain
You should now have DokuWiki installed and accessible via HTTPS.
Conclusion
Congratulations! You have successfully installed DokuWiki with Nginx and Let's Encrypt SSL on FreeBSD 12. You can now start using DokuWiki to create and manage your wiki documentation.