
How to Install WonderCMS with Nginx on Debian 10: A Step-by-Step Guide
WonderCMS is a remarkably simple and lightweight flat-file Content Management System (CMS). Because it doesn’t require a database, it’s incredibly fast, easy to set up, and has a minimal server footprint. This makes it an excellent choice for portfolios, small business websites, and personal blogs where speed and simplicity are paramount.
This guide will walk you through the complete process of installing WonderCMS on a Debian 10 server using Nginx as the web server. We will cover everything from system preparation to configuring Nginx and securing your site.
Prerequisites
Before we begin, ensure you have the following ready:
- A server running Debian 10.
- Root or sudo access to the server.
- A domain name pointed to your server’s IP address.
Step 1: Update Your System
First, it’s always best practice to update your server’s package list and upgrade existing packages to their latest versions. This ensures system stability and security.
Connect to your server via SSH and run the following commands:
sudo apt update
sudo apt upgrade -y
Step 2: Install Nginx Web Server
Nginx is a high-performance web server that is perfect for hosting a lightweight application like WonderCMS. To install Nginx, use the following command:
sudo apt install nginx -y
Once the installation is complete, you can start and enable the Nginx service to ensure it runs automatically on server boot:
sudo systemctl start nginx
sudo systemctl enable nginx
You can verify that Nginx is running by visiting your server’s IP address in a web browser. You should see the default Nginx welcome page.
Step 3: Install PHP-FPM and Required Extensions
WonderCMS is built with PHP, so we need to install PHP and the necessary extensions. We will use PHP-FPM (FastCGI Process Manager), which is the standard way to handle PHP processing with Nginx.
Install PHP-FPM along with the extensions WonderCMS needs:
sudo apt install php-fpm php-zip php-mbstring php-gd -y
- php-fpm: The core PHP processor.
- php-zip: Required for handling zip archives.
- php-mbstring: Used for managing non-ASCII strings.
- php-gd: An image processing library.
Step 4: Download and Set Up WonderCMS
Now we will create a directory for our WonderCMS installation, download the latest version, and set the correct permissions.
First, create the project directory. We’ll use /var/www/wondercms
as our root directory.
sudo mkdir -p /var/www/wondercms
Navigate into the new directory:
cd /var/www/wondercms
Download the latest version of WonderCMS from its official source.
sudo wget https://github.com/robiso/wondercms/releases/download/latest/wondercms.zip
Unzip the downloaded file:
sudo unzip wondercms.zip
Next, it is critically important to set the correct file ownership. The web server user (typically www-data
on Debian) needs to own the files to manage them properly.
sudo chown -R www-data:www-data /var/www/wondercms
Finally, clean up the downloaded zip file:
sudo rm wondercms.zip
Step 5: Configure the Nginx Server Block
The heart of our setup is the Nginx server block (also known as a virtual host). This file tells Nginx how to handle requests for your domain and where to find the website files.
Create a new configuration file for your WonderCMS site:
sudo nano /etc/nginx/sites-available/wondercms.conf
Paste the following configuration into the file. Remember to replace your_domain.com
with your actual domain name.
server {
listen 80;
server_name your_domain.com www.your_domain.com;
root /var/www/wondercms;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Deny access to sensitive files
location ~ /(database|files) {
deny all;
}
location ~* \.(json)$ {
deny all;
}
# Process PHP files
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; # Check your PHP version
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Note: The fastcgi_pass
path may differ depending on your PHP version. You can check the correct path by listing the contents of /var/run/php/
. For Debian 10, it is typically php7.3-fpm.sock
.
Save and close the file (Ctrl+X, then Y, then Enter).
Now, enable the new site by creating a symbolic link from sites-available
to sites-enabled
:
sudo ln -s /etc/nginx/sites-available/wondercms.conf /etc/nginx/sites-enabled/
Test your Nginx configuration for any syntax errors:
sudo nginx -t
If you see a “syntax is ok” message, you can safely reload Nginx to apply the changes:
sudo systemctl reload nginx
Step 6: Finalize the Installation in Your Browser
With the server configured, you can now complete the installation.
Open your web browser and navigate to your domain (http://your_domain.com
).
You will be greeted by the WonderCMS welcome screen. It will ask you to create a password. This is the only step needed to secure your site. Choose a strong, unique password and log in.
That’s it! Your WonderCMS installation is complete. You can now start building your website.
Security Tip: Secure Your Site with a Free SSL Certificate
Running your site over HTTPS is essential for security and SEO. We can install a free SSL certificate from Let’s Encrypt using Certbot.
First, install the Certbot Nginx plugin:
sudo apt install python3-certbot-nginx -y
Now, run Certbot to automatically obtain and configure the SSL certificate for your domain:
sudo certbot --nginx -d your_domain.com -d www.your_domain.com
Certbot will guide you through the process, including asking for your email address and agreeing to the terms of service. When prompted, choose the option to redirect all HTTP traffic to HTTPS.
Certbot will automatically update your Nginx configuration and reload the server. Your site is now secure and accessible via https://your_domain.com
.
Source: https://kifarunix.com/install-wondercms-with-nginx-on-debian-10/