DokuWiki is a powerful and lightweight open-source Wiki software application written in PHP. It offers a clean and readable syntax, making it easy to create and edit websites directly from the web browser. One of the key advantages of DokuWiki is that it uses a file to store its data instead of a database, which simplifies maintenance and backup processes. In this tutorial, we will guide you through the installation process of DokuWiki with Apache and Let’s Encrypt SSL on Debian 11, ensuring that your website is secure and fully functional.
Prerequisites
Before we begin, let’s ensure that you have the necessary prerequisites in place:
- A server running Debian 11.
- A valid domain name pointed to your server’s IP address.
- A root password configured on the server.
Step 1: Updating System Packages
To get started, it is recommended to update your system packages to the latest versions. You can do this by running the following command:
apt-get update -y
Step 2: Installing Apache and PHP
DokuWiki runs on either Apache or Nginx and is written in PHP. Therefore, we need to install Apache, PHP, and other required extensions to our server. Run the following command to install them:
apt-get install apache2 php php-gd php-xml php-json -y
Once the installation is complete, start the Apache service and enable it to start at system reboot:
systemctl start apache2 systemctl enable apache2
Step 3: Installing DokuWiki
Now, let’s proceed with the installation of DokuWiki. First, navigate to the DokuWiki download page and fetch the latest version of DokuWiki using the following command:
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
Once the download is complete, create a directory for DokuWiki inside the Apache web root directory:
mkdir /var/www/html/dokuwiki
Next, extract the downloaded file to the DokuWiki directory using the following command:
tar -xvzf dokuwiki-stable.tgz -C /var/www/html/dokuwiki/ --strip-components=1
Now, copy some necessary files using the following command:
cp /var/www/html/dokuwiki/.htaccess{.dist,}
To ensure proper ownership of the DokuWiki directory, run the following command:
chown -R www-data:www-data /var/www/html/dokuwiki
Step 4: Creating an Apache Virtual Host for DokuWiki
To host DokuWiki on the internet, we need to create an Apache virtual host configuration file. Use the following command to create the file:
nano /etc/apache2/sites-available/dokuwiki.conf
Add the following lines to the file:
<VirtualHost *:80>
ServerName dokuwiki.example.com
DocumentRoot /var/www/html/dokuwiki
<Directory ~ "/var/www/html/dokuwiki/(bin/|conf/|data/|inc/)">
<IfModule mod_authz_core.c>
AllowOverride All
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
</IfModule>
</Directory>
ErrorLog /var/log/apache2/dokuwiki_error.log
CustomLog /var/log/apache2/dokuwiki_access.log combined
</VirtualHost>
Save and close the file. Then, enable the virtual host configuration by running the following command:
a2ensite dokuwiki.conf
To apply the changes, reload Apache:
systemctl reload apache2
You can verify the status of Apache using the following command:
systemctl status apache2
Step 5: Securing DokuWiki with Let’s Encrypt SSL
Now that Apache is configured, it is recommended to secure your DokuWiki site with a Let’s Encrypt SSL certificate. To do this, we will install the Certbot client, which simplifies the process of obtaining and deploying SSL certificates. Install Certbot and the Apache plugin using the following command:
apt-get install certbot python3-certbot-apache -y
Once the installation is complete, run the following command to obtain and install the Let’s Encrypt SSL certificate for your website:
certbot --apache -d dokuwiki.example.com
Follow the prompts to provide your email address and accept the terms of service. Certbot will handle the certificate issuance and configuration for you.
Step 6: Setting Up Let’s Encrypt SSL Certificate Auto-Renewal
By default, Let’s Encrypt SSL certificates are valid for 90 days. To ensure uninterrupted service, it is essential to set up automatic renewal of these certificates. You can do this by creating a cron job that runs regularly. Open the crontab file using the following command:
crontab -e
Add the following line to the file to schedule the renewal process to run every day at 10:00 AM:
00 10 * * * root /usr/bin/certbot renew >/dev/null 2>&1
Save and close the file. This cron job will automatically renew your SSL certificate.
Step 7: Accessing DokuWiki
Now that DokuWiki is installed and secured, you can access it through your web browser. Open the URL https://dokuwiki.example.com/install.php
and you should see the DokuWiki installation screen.
Provide the required information, such as your wiki name, admin username, password, and email. Choose your preferred settings and click on the Save button. You will then be redirected to the main DokuWiki page.
Click on “your new DokuWiki” and you will be directed to the DokuWiki login screen. Enter your admin username and password, and click on the Log In button. You should now have access to the DokuWiki dashboard, where you can start creating and managing your wiki content.
Conclusion
Congratulations! You have successfully installed DokuWiki with Let’s Encrypt SSL on Debian 11. With this powerful Wiki software, you can easily create and manage your website from your web browser. By following the steps in this tutorial, you have ensured that your DokuWiki installation is secure and protected with an SSL certificate. Enjoy exploring the features and benefits of DokuWiki, and feel free to reach out if you have any questions or need further assistance.
If you’re looking for reliable and scalable cloud hosting solutions, Shape.host offers Cloud VPS services that can meet your needs. With their expertise in cloud hosting, you can trust Shape.host to provide efficient and secure hosting for your website. Visit Shape.host today to explore their range of services and find the perfect solution for your business.