How to Install WonderCMS with Nginx on Debian 12, 11 or 10

WonderCMS, a free and open-source content management system (CMS), stands out in the crowded CMS landscape, emphasizing simplicity, speed, and security. Unlike many CMS platforms that rely on traditional databases, WonderCMS utilizes a flat file system, offering distinct advantages for those prioritizing efficiency. This guide will delve into the unique features of WonderCMS and demonstrate how to install it, especially for those considering alternatives to popular platforms like WordPress.

Key Advantages of WonderCMS:

  • Simplicity: Its user-friendly interface ensures even beginners can manage content effortlessly, avoiding the potential complexities of platforms like WordPress.
  • Performance: The flat file system means no database queries, resulting in faster page loads, enhancing user experience, and potentially boosting SEO.
  • Security: WonderCMS boasts features like a unique login URL, hashed and salted passwords, and CSRF protection against potential attacks.
  • Lightweight Design: With an installation package under 15KB, it’s ideal for conserving server resources.
  • Customization: While streamlined, WonderCMS offers a range of themes and plugins for tailored site design, maintaining optimal performance even with added features.

WonderCMS vs. WordPress:

  • User Experience: While WordPress offers diverse features, it can be complex. In contrast, WonderCMS focuses on essential, easy-to-navigate features.
  • System Requirements: WordPress demands more server resources with its PHP and MySQL requirements, whereas WonderCMS’s flat file system is resource-efficient.
  • Security: Both prioritize security, but WordPress, being more popular, is often targeted by hackers. WonderCMS’s unique login URL adds an extra security layer.
  • Customizability: WordPress’s vast plugin/theme libraries surpass WonderCMS’s offerings. However, WonderCMS allows direct source code modifications for unique customizations.

In conclusion, the choice between WonderCMS, WordPress, or any other CMS hinges on individual needs. If you value a streamlined, secure, and speedy platform, WonderCMS could be your ideal choice. Let’s now dive into the installation process for WonderCMS.

Install Nginx on Debian 12, 11, or 10 for WonderCMS

Step 1: Update the Debian System Before the Nginx Installation

Before we start the installation of WonderCMS, it’s crucial to have an up-to-date system. This ensures you have the latest security patches, bug fixes, and software features for optimal system stability and performance. Run the following command to update all existing packages:

sudo apt update && sudo apt upgrade

If your system prompts for any significant upgrades, such as the Linux Kernel, remember to reboot your server to make sure the updates take effect correctly.

Step 2: Install Nginx via APT Command on Debian

Having ensured that your Debian system is updated, let’s install Nginx. Nginx is a high-performance HTTP server and reverse proxy that we will use to serve our WonderCMS website. Execute the command below to install Nginx:

sudo apt install nginx

Upon successful installation, the Nginx service is typically activated by default. Nonetheless, we must verify its functioning correctly to avoid potential hiccups later. Use the following command to check the status of Nginx:

systemctl status nginx

You should see an output indicating that Nginx is active and running. If, for any reason, the Nginx service hasn’t been activated, use the following command to enable it:

sudo systemctl enable nginx --now

Enabling the service ensures that Nginx starts automatically every time the server is rebooted, which is crucial for maintaining the uptime of your WonderCMS site.

To further enhance your WonderCMS site’s performance, it’s advisable to use the latest Nginx mainline version. This version includes additional features and enhancements that improve your website’s speed and overall performance. For instructions on how to install the latest Nginx mainline directly from Nginx’s APT repository, please follow this guide: Install Nginx Mainline on Debian Linux.

Fine-tuning UFW Firewall for Nginx

Step 1: Installation of UFW

To enhance the security of your Nginx server, it’s vital to configure your firewall settings properly. The Uncomplicated Firewall (UFW) is a user-friendly interface for managing iptables firewall rules. It provides an easy way to build a robust firewall while maintaining simplicity in configuration.

If UFW is not already installed on your Debian system, you can add it using the following command:

sudo apt install ufw

Step 2: Enable UFW

With UFW installed, it’s time to activate it on your system. By default, UFW is set to deny all incoming connections while allowing all outgoing ones. This setting helps create a safe default environment until you can open services to outside traffic.

Execute the following command to enable UFW:

sudo ufw enable

Step 3: Review Available Nginx Profiles

Now that UFW is active let’s focus on configuring it specifically for Nginx. UFW has application profiles, which are essentially predefined settings for various applications. Nginx comes with its own set of profiles that simplify this process. Run the following command to view the available Nginx profiles:

sudo ufw app list

The output reveals three profiles for Nginx. The Nginx HTTP profile allows traffic on port 80 (HTTP), Nginx HTTPS permits traffic on port 443 (HTTPS), and Nginx Full combines the two, permitting traffic on HTTP and HTTPS.

Step 4: Configuring UFW with an Nginx Profile

Deciding which profile to use will depend on your specific requirements. If your website needs to accommodate both secure (HTTPS) and non-secure (HTTP) traffic, apply the Nginx Full profile:

sudo ufw allow 'Nginx Full'

However, if you’re aiming to provide only secure traffic, employ the Nginx HTTPS profile:

sudo ufw allow 'Nginx HTTPS'

If your use case is such that you only require HTTP access, implement the Nginx HTTP profile:

sudo ufw allow 'Nginx HTTP'

It’s also worth mentioning that if you wish to allow a specific port, say 8080, for a specific application, you can do so by executing the following:

sudo ufw allow 8080

Remember that your configuration choices should mirror your specific server requirements and conform to best security practices.

Install PHP and PHP-FPM for WonderCMS on Debian 12, 11, or 10

Step 1: Proceed to Install PHP on Debian

PHP, an open-source scripting language, is a crucial component for running WonderCMS, as it interprets and processes the code of your website. Utilizing the latest stable PHP version is often recommended for improved performance, security, and support for newer functionalities. More detailed instructions on installing the most recent PHP version can be found here.

To install PHP along with PHP-FPM (FastCGI Process Manager) and the necessary modules on your Debian system, use the following command:

sudo apt install php php-fpm php-mbstring php-bcmath php-common php-cli php-curl php-zip

Step 2: Verifying PHP Service Status

After the installation process is completed, it’s crucial to verify the status of the PHP service to ensure it’s functioning correctly. You can do this similarly to how you checked the status of MariaDB and Nginx. Here, we’ll look at PHP 8.2, the default version on Debian 12 Bookworm. Run the following command to verify the status:

systemctl status php8.2-fpm

Confirming the PHP Version

As a final step, you might want to confirm the specific PHP version installed on your system. This can be useful if you need to troubleshoot or are preparing for updates. Display the installed PHP version by running the following command:

php -v

With PHP and PHP-FPM properly set up on your Debian system, you can continue your WonderCMS installation. Ensuring the correct PHP version is running is essential for the overall functionality and efficiency of your WonderCMS setup. Remember, updating your PHP version can provide performance improvements, more security, and access to the latest features and enhancements.

Install WonderCMS on Debian 12, 11 or 10

Step 1: Download WonderCMS on Debian

The first part of installing WonderCMS involves downloading the software archive package. You can access the latest version of WonderCMS through the official GitHub releases page, available here.

To download the file directly to your Debian system, you will employ either the wget or curl command in the terminal.

wget https://github.com/WonderCMS/wondercms/releases/download/x.x.x/wondercms-xxx.zip

The link above serves as a template. You must replace it with the most current link from the official release page.

Step 2: Create WonderCMS Folder Structure

With the WonderCMS archive downloaded, it’s time to extract the package and move its contents to the appropriate directory (www directory). Begin by creating a new directory specifically for WonderCMS:

sudo mkdir -p /var/www/wondercms

Then, extract the WonderCMS files to the www directory:

sudo unzip wondercms*.zip -d /var/www/

Should you encounter issues with the above command, it may be necessary to install the zip package:

sudo apt install zip unzip

Step 3: Configuring Proper Permissions for WonderCMS

Next, setting the correct directory owner permissions for WonderCMS is crucial. Without the proper permissions set to www-data, WonderCMS may experience write permission issues. The commands below will ensure the appropriate ownership and permission settings:

sudo chown -R www-data:www-data /var/www/wondercms/
sudo find /var/www/wondercms -type d -exec chmod 755 {} \;
sudo find /var/www/wondercms -type f -exec chmod 644 {} \;

Step 4: Create Nginx Server Block Configuration for WonderCMS

To set up the server block for WonderCMS, create a new server block file:

server {
    listen 80;
    server_name www.wonder-example.com;
    root /var/www/wondercms;
    index index.php;
    autoindex off;

    location / {
        try_files $uri $uri/ @rewrite;
    }

    location @rewrite {
        rewrite ^/(.+)$ /index.php?page=$1 last;
    }

    location ~ database.js {
        return 403;
    }

    location ~ cache.json {
        return 403;
    }

    location ~ \.php$ {
      fastcgi_pass unix:/run/php/php8.2-fpm.sock;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
      include snippets/fastcgi-php.conf;
      fastcgi_buffer_size 128k;
      fastcgi_buffers 4 128k;
      fastcgi_intercept_errors on; 
    }
}

This is a critical step, as the Nginx server block works like a virtual host for users migrating from Apache-based web applications. It defines how to respond to requests for a specific website.

Ensure that you replace all placeholder text (www.wonder-example.com, example.com, etc.) with the actual domain and paths you’re using.

Step 5: Enable WonderCMS Nginx Server Block

Once you’ve created your server block configuration file, it’s time to enable it. This process involves creating a symbolic link from the sites-available directory to the sites-enabled directory. Execute the following command:

sudo ln -s /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/

Replace example.com.conf with your actual configuration file’s name.

Then, execute a test run to check your Nginx configuration:

sudo nginx -t

If the configuration test runs successfully without returning any errors, you can restart the Nginx service:

sudo systemctl restart nginx

Step 6: Adjusting the PHP.ini Configuration

Before proceeding to the web-based setup, optimizing your PHP settings to accommodate WonderCMS is advisable. Let’s edit the PHP.ini file to adjust a few parameters, which will improve the overall performance of your CMS.

To start, open the PHP.ini file. Note that its location might differ based on your PHP version:

sudo nano /etc/php/{version}/fpm/php.ini

Here are some recommendations that you can follow to enhance your CMS’s performance:

upload_max_filesize = 100MB
post_max_size = 100MB
max_execution_time = 120
max_input_vars = 5000
memory_limit = 256M

After making the necessary changes, restart your PHP-FPM server:

sudo systemctl restart php{version}-fpm

Step 7: Update Nginx Server Block

The final step involves revisiting your Nginx server block to accommodate larger body sizes. To do this, reopen your server block file:

sudo nano /etc/nginx/sites-available/example.com

Add the following line to increase the allowed body size:

client_max_body_size 100M;

Ensure that the client_max_body_size value aligns with your PHP file settings.

Lastly, test your changes:

sudo nginx -t

If everything checks out, restart your Nginx service to apply the changes:

sudo systemctl restart nginx

With this step, you have successfully configured your Debian system for WonderCMS and can proceed to the GUI section to complete the setup.

Access WonderCMS on Debian 12, 11 or 10

With the backend configurations complete, it’s time to bring our attention to the front end of the WonderCMS platform: the Web User Interface (WebUI). This is where the heart of your website’s content management occurs.

Step 1: Accessing the Installation Page

To begin, open your preferred web browser and navigate to your domain where WonderCMS is set up:

https://www.yoursite.com

Replace ‘yoursite.com’ with your actual domain. This will initiate the WonderCMS installation process.

Step 2: Logging Into WonderCMS

You will be greeted by an initial page displaying a temporary password and a ‘Login’ button.

Screenshot showcasing the welcome page of a site set up using WonderCMS, Nginx, and Debian Linux.
Initial view of a website powered by WonderCMS and Nginx on Debian Linux.

To proceed, click on the ‘Login’ button and enter the temporary password provided. If you fail to remember or misplace the password, navigate back, copy the temporary password again, and retry logging in.

Login page screenshot for WonderCMS hosted on Nginx and Debian Linux.
Secure login portal for managing content on WonderCMS integrated with Nginx on Debian Linux.

Step 3: Configuring Your Website

Upon successful login, you will land on a page that mirrors the initial login page. However, this new interface is an editable page of your CMS. At the top of this page, you’ll notice an option labeled ‘Change settings.’

Click on ‘Change settings’ to access the configuration panel for your site. It is strongly recommended to update your settings promptly to bolster your website’s security.

Screenshot of first-time user login interface for WonderCMS on Debian Linux with Nginx.
Initial login view for users accessing WonderCMS for the first time on a Debian Linux system integrated with Nginx.

Step 4: Customizing Your WonderCMS Website

After ensuring the security of your website, it’s time for the fun part — customizing your site! WonderCMS offers a variety of options for personalizing your website. You can add new pages, alter themes, and adjust the overall aesthetics of your site to match your unique preferences.

Screenshot showcasing themes, plugins, and additional features in WonderCMS on Debian Linux with Nginx.
Explore a plethora of themes, plugins, and more with WonderCMS hosted on Debian Linux integrated with Nginx.

Feel free to explore and experiment with the customization options. After all, your website should reflect your individuality and cater to the needs of your specific audience.

Optional: Configure HTTPS with Let’s Encrypt for WonderCMS

Website security is paramount to ensure user privacy and data protection. Leveraging HTTPS is one such way to secure your website, and Let’s Encrypt provides a free, automated, and open certificate authority for this purpose. It is operated by the nonprofit Internet Security Research Group (ISRG). This guide will navigate you through implementing HTTPS using Let’s Encrypt for your WonderCMS website on Nginx.

Step 1: Installation of the Certbot Package

Kickstart the process by installing the Certbot package. The Certbot package is necessary for obtaining SSL certificates from Let’s Encrypt and configuring HTTPS on the server. Use the following command:

sudo apt install python3-certbot-nginx -y

Step 2: Generating an SSL Certificate

Once the Certbot package installation is successful, the next step involves generating your SSL certificate. The command shown below accomplishes this. Remember to replace the email and domain name placeholders with your actual details:

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email you@example.com -d www.example.com

The command above generates the SSL certificate and sets up a secure configuration. It includes forced HTTPS 301 redirects, a Strict-Transport-Security header, and OCSP Stapling. Remember to adjust the email and domain name as per your specific needs.

Your website URL will now use https://www.example.com instead of http://www.example.com. Any attempts to access the previous HTTP URL will automatically redirect to the new HTTPS version.

Setting up Automatic Certificate Renewal

SSL certificates require regular renewal to stay valid. Setting up a cron job will automate renewal and update your SSL certificates. Certbot comes with a script that takes care of this process.

Start by testing the renewal process with a dry run. This test helps to ensure that the automatic renewal process will function as expected when the certificate nears expiration:

sudo certbot renew --dry-run

If the dry run executes without errors, the next step is to open the crontab window:

sudo crontab -e

Establish a new cron job in the crontab window to carry out daily checks for certificate renewals. If renewal is required, the script will manage the update automatically. Use the command below as a template and modify the schedule as required:

00 00 */1 * * /usr/sbin/certbot-auto renew

Closing Thoughts

In summary, the steps guide installing and customizing WonderCMS on a Debian server using Nginx. We began by detailing the installation process, discussing how to optimize performance, enhancing security with Let’s Encrypt SSL certificates, and setting up automatic certificate renewal. The information presented will equip you with the necessary skills to successfully deploy and maintain your WonderCMS website.

Leave a Comment