DokuWiki is a popular open-source wiki software designed for Linux systems. It offers a lightweight and easy-to-install solution for collaborative documentation and knowledge management. In this tutorial, we will guide you through the process of installing DokuWiki with Nginx and Let’s Encrypt SSL on Alma Linux. By following these steps, you will be able to create and maintain a secure and efficient wiki site for your organization.
Prerequisites
Before we begin, make sure you have the following:
- A server running Alma Linux 8.
- A valid domain name pointed to your server’s IP address.
- Root access to the server.
Install Nginx and PHP
To get started, we need to install Nginx and PHP on your Alma Linux server. By default, Alma Linux does not include the latest version of PHP in its default repository, so we’ll need to enable the EPEL and Remi repositories.
dnf install epel-release -y dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
Once the repositories are installed, enable the PHP Remi repository:
dnf module enable php:remi-7.4 -y
Now, install Nginx, PHP, and other required extensions:
dnf install nginx php php-cli php-fpm php-gd php-xml php-zip -y
After the installation is complete, we need to edit the PHP-FPM configuration file:
nano /etc/php-fpm.d/www.conf
In this file, change the user
and group
values to nginx
:
user = nginx group = nginx
Save and close the file. Then, start and enable Nginx and PHP-FPM services:
systemctl start nginx php-fpm systemctl enable nginx php-fpm
To verify the PHP version, run the following command:
php --version
Install DokuWiki on Alma Linux 8
Now that we have Nginx and PHP set up, let’s proceed with installing DokuWiki. Start by downloading the latest stable version of DokuWiki from their official website:
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
Once the download is complete, create a directory for DokuWiki in the Nginx web root:
mkdir /var/www/html/dokuwiki
Extract the downloaded file and move the contents to the DokuWiki directory:
tar xvf dokuwiki-stable.tgz mv dokuwiki-2020-07-29/* /var/www/html/dokuwiki/
Change the ownership of the DokuWiki directory to Nginx:
chown -R nginx:nginx /var/www/html/dokuwiki
Create an Nginx Virtual Host for DokuWiki
Next, we need to create an Nginx configuration file for DokuWiki. Run the following command to open a new file:
nano /etc/nginx/conf.d/dokuwiki.conf
In this file, add the following configuration:
server { listen 80; server_name wiki.example.com; root /var/www/html/dokuwiki; index index.html index.htm index.php doku.php; client_max_body_size 15M; client_body_buffer_size 128K; location / { try_files $uri $uri/ @dokuwiki; } location ^~ /conf/ { return 403; } location ^~ /data/ { return 403; } location ~ /\.ht { deny all; } 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 ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/run/php-fpm/www.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }
Save and close the file. To verify the Nginx configuration for any syntax errors, run the following command:
nginx -t
If there are no errors, restart the Nginx service to apply the changes:
systemctl restart nginx
You can check the status of Nginx using the following command:
systemctl status nginx
Access DokuWiki Web Interface
Now that DokuWiki is installed and the Nginx virtual host is configured, it’s time to access the DokuWiki web interface and complete the installation.
Open your web browser and enter the following URL:
http://wiki.example.com/install.php
You should see the DokuWiki installation wizard. Provide the required information, including the superuser name, email, and password. Click on the “Save” button to proceed with the installation.
Once the installation is complete, you will see a confirmation page. Click on your new DokuWiki to access the login page. Enter the admin username and password to log in to the DokuWiki dashboard.
After successfully configuring DokuWiki, it’s important to remove the installation file from the DokuWiki root directory:
rm -rf /var/www/html/dokuwiki/install.php
Secure DokuWiki with Let’s Encrypt
To ensure the security of your DokuWiki website, it’s recommended to secure it with Let’s Encrypt SSL. Let’s Encrypt is a free and widely trusted certificate authority that provides SSL certificates.
To install Let’s Encrypt Certbot on your server, run the following commands:
dnf install epel-release -y dnf install certbot -y
Once Certbot is installed, you can obtain and install the Let’s Encrypt SSL certificate for your website:
certbot --nginx -d wiki.example.com
During the installation process, you will be prompted to provide your email address and agree to the terms of service. Follow the instructions on the screen to complete the installation.
Congratulations! Your DokuWiki website is now secured with Let’s Encrypt SSL. You can access your website securely using the URL:
https://wiki.example.com
Conclusion
In this tutorial, we have walked you through the process of installing and configuring DokuWiki with Nginx and Let’s Encrypt SSL on Alma Linux. By following these steps, you have created a secure and efficient wiki site for your organization. DokuWiki’s lightweight and easy-to-install nature, combined with Nginx’s performance and Let’s Encrypt’s SSL certificates, ensures a reliable and scalable solution for collaborative documentation and knowledge management.
If you have any questions or need further assistance, feel free to reach out to our team at Shape.host. We specialize in providing reliable and secure cloud hosting solutions, including Cloud VPS, to empower businesses with efficient and scalable infrastructure. Visit our website to learn more about our services and how we can help your organization thrive in the digital world.