How to Install WonderCMS on Debian 12

WonderCMS is a lightweight, open-source content management system (CMS) designed for simplicity and ease of use. Unlike many other CMS platforms that require extensive setup or heavy resources, WonderCMS operates on a single flat-file database, meaning it doesn't need a traditional database system like MySQL. This makes it extremely easy to install and manage, often requiring no more than uploading the CMS files to a server. Despite its small size, WonderCMS offers essential features like content editing, SEO options, theme customization, and plugin support, making it a viable option for users who want a minimalistic, straightforward solution for building and managing websites.

In this tutorial, we will show you how to install WonderCMS on a Debian 12 server with Apache web server and PHP 8.x.

Prerequisites

Make sure you have the following before starting:

  • A Debian 12 server.
  • A non-root user with administrator privileges.
  • A domain name pointed to a server IP address.

Installing Dependencies

WonderCMS is an open-source content management system written in PHP. It's a flat CMS, which means it doesn't require a database like MySQL/MariaDB to install. It used text files as a database.

In this guide, you will install WonderCMS with Apache web server and PHP 8.2.

Before installing packages, refresh and update the Debian repository using the command below.

sudo apt update

Once updated, install dependencies for WonderCMS by executing the command below. WonderCMS is a flat CMS, it doesn't require a database. So you will install only Apache web server and PHP packages.

sudo apt install apache2 php php-common php-mbstring php-curl php-zip unzip

Type y to confirm the installation.

install deps

After installation is complete, verify the Apache service with the command below. Apache should be running and enabled by default.

sudo systemctl is-enabled apache2
sudo systemctl status apache2

Below you can see the Apache service enabled and running.

verify apache

Lastly, verify the PHP version and enable extensions with the following command.

php -m
php -v

In the output below, you can see that PHP 8.2 is installed.

verify php

Configuring PHP

After installing dependencies, you need to configure PHP for the WonderCMS. You will need to modify the php.ini configuration for the Apache web server and change some of the default settings, such as timezone, memory limit, execution time, and max upload filesize.

Open the php.ini configuration for the Apache web server using the following nano editor command.

sudo nano /etc/php/8.2/apache2/php.ini

Change the default PHP configuration like the following - Be sure to adjust the timezone and memory_limit with your current server environment.

date.timezone = "Europe/Amsterdam"
memory_limit = 512M

upload_max_filesize = 128MB
post_max_size = 128MB

max_execution_time = 300
max_input_vars = 5000

Save and exit the file when you're finished.

Now restart the Apache service to apply your modification on PHP.

sudo systemctl restart apache2

Configuring Firewall

In this guide, you will run WonderCMS with a firewall enabled. In this example, you will be using UFW. So now you need to install UFW and open ports for SSH, HTTP, and HTTPS services.

Install UFW to your Debian server with the following command. Type y to confirm and proceed.

sudo apt install ufw

install ufw

Once the installation is complete, enable the OpenSSH profile to open port 22 and the "WWW Full" profile to open both HTTP and HTTPS ports.

sudo ufw allow OpenSSH
sudo ufw allow "WWW Full"

Now run the following command to start and enable UFW. Type y to confirm, and then UFW should be running and enabled.

sudo ufw enable

setup ufw

Lastly, verify the UFW status using the command below. Both OpenSSH and "WWW Full" profiles are enabled on UFW.

sudo ufw status

verify ufw

Downloading WonderCMS Source Code

In this section, you will download the WonderCMS source code and configure the document-root directory with proper permission and ownership. Before you begin, make sure to visit the WonderCMS GitHub page and grab the latest download link.

Go to the /var/www directory and download the WonderCMS source code using the wget command below.

cd /var/www/
wget https://github.com/WonderCMS/wondercms/releases/download/3.4.3/wondercms-343.zip

Once downloaded, extract the WonderCMS source code to the /var/www/wondercms directory using the unzip command.

unzip wondercms-343.zip -d /var/www/wondercms

Lastly, change the ownership of /var/www/wondercms directory to user www-data. With this, you allow Apache to read, write, and execute to WonderCMS document root directory.

sudo chown -R www-data:www-data /var/www/wondercms
sudo chmod -R 755 /var/www/wondercms

Configuring Apache Virtual Host

In this example, you will run WonderCMS with Apache, so you need to create the virtual host configuration for that. Be sure your domain name points to your Debian server IP address.

Firstly, use the command below to enable the rewrite module on Apache. WonderCMS required mod_rewrite to be enabled.

sudo a2enmod rewrite

enable rewrite

Once enabled, create a new virtual host configuration /etc/apache2/sites-available/wondercms.conf using the nano editor command.

sudo nano /etc/apache2/sites-available/wondercms.conf

Insert the following configuration. Make sure to change the domain name, the path of the document root directory, and log files with your information.

<VirtualHost *:80>
ServerName cms.howtoforge.local
DirectoryIndex index.php
DocumentRoot /var/www/wondercms
Redirect /wondercms/loginURL /loginURL

ErrorLog /var/log/apache2/cms.howtoforge.local-error.log
CustomLog /var/log/apache2/cms.howtoforge.local-access.log combined

<Directory /var/www/wondercms>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>

</VirtualHost>

Save and exit the file when you're done.

Next, execute the following command to enable the virtual host file wondercms.conf. Then, verify Apache and ensure you have proper syntax.

sudo a2ensite wondercms.conf
sudo apachectl configtest

You should get an output Syntax OK if you have proper Apache syntax.

setup vhost

Lastly, run the command below to restart the Apache service and apply your changes. With this, your WonderCMS installation should be ready.

sudo systemctl restart apache2

Securing WonderCMS with Letsencrypt

Once you configure the Apache virtual host, secure your WonderCMS installation with HTTPS. In this case, you will use Certbot and Letsencrypt.

You can generate self-signed certificates for local domain names or internal networks to secure your WonderCMS installation.

Install Certbot and the Certbot Apache plugin using the command below. Type y to confirm the installation.

sudo apt install certbot python3-certbot-apache

Once the installation is complete, generate SSL certificates for your WonderCMS domain name. Also, be sure to change the domain name and email address to match your information.

sudo certbot --apache --agree-tos --no-eff-email --redirect --hsts --staple-oscp --email [email protected] -d cms.howtoforge.local

Once the process is finished, your certificate should be available in the /etc/letsencrypt/live/howtoforge.local directory. Your WonderCMS installation should automatically secured with HTTPS.

Accessing WonderCMS Installation

Open the web browser and visit your WonderCMS domain name, such as https://howtoforge.local/. On the WonderCMS homepage, you should see the generated password. Copy the password and save it in the secret place.

index

Conclusion

Congratulations! You have successfully installed WonderCMS on the Debian 12 server, along with an Apache web server and PHP 8.2. You have also secured WonderCMS with UFW and SSL certificates from Letsencrypt.

Share this page:

0 Comment(s)