WonderCMS is an open-source and extremely small flat file CMS that provides a simple and easier way to create and manage websites. It is written in PHP and jQuery and doesn’t require any configuration. It provides all the necessary features available in the modern CMS. It’s fast, responsive, and doesn’t require any database. It offers a user-friendly web UI with a single basic drop-down menu while activating inline editing controls on your pages.

This tutorial will show you how to install WonderCMS with Nginx and Let’s Encrypt SSL on Ubuntu 22.04.

Prerequisites

  • A server running Ubuntu 22.04.
  • A valid domain name is pointed to your server IP.
  • A root password is configured on the server.

Install Nginx and PHP

First, you will need to install the Nginx web server, PHP, and other dependencies on your server. You can install all of them by running the following command:

apt-get install nginx php php-fpm php-mbstring php-curl php-zip -y

Once all the packages are installed, edit the PHP configuration file and modify some default settings:

nano /etc/php/8.1/fpm/php.ini

Change the following settings:

upload_max_filesize = 100MB
post_max_size = 100MB
max_execution_time = 300
max_input_vars = 5000
memory_limit = 256M
date.timezone = "UTC"

Save and close the file then restart the PHP-FPM service to apply the changes:

systemctl restart php8.1-fpm

Install WonderCMS Ubuntu 22.04

First, you will need to download the latest version of WonderCMS from GitHub using the following command:

wget https://github.com/robiso/wondercms/releases/download/3.3.4/wondercms-334.zip

Once the download is completed, unzip the downloaded file to the Nginx web root directory using the following command:

unzip wondercms-334.zip -d /var/www/html

Next, change the ownership and permission of the WonderCMS with the following command:

chown -R www-data:www-data /var/www/html/wondercms

chmod -R 775 /var/www/html/wondercms

Once you are done, you can proceed to the next step.

Configure Nginx for WonderCMS

Next, you will need to create an Nginx virtual host configuration file to host WonderCMS with Nginx. You can create it with the following command:

nano /etc/nginx/conf.d/wondercms.conf

Add the following lines:

server {
        listen 80;
        # adapt to your server name
        server_name wondercms.example.com;
        # adapt the path
        root /var/www/html/wondercms;
        index index.php;
        # prevent directory listing
        autoindex off;

        # rewrite url to make it pretty
        location / {
            try_files $uri $uri/ @rewrite;
        }
            location @rewrite {
            rewrite ^/(. )$ /index.php?page=$1 last;
        }

        # prevent access to database.js
        location ~ database.js {
            return 403;
        }

        location ~ cache.json {
            return 403;
        }

        # use php-fpm for dealing with php files

location ~ .php$ {
      fastcgi_pass unix:/run/php/php-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; 
        }
    }

Save and close the file then verify the Nginx for any syntax error using the following command:

nginx -t

You will get the following output:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Next, restart the Nginx service to apply the changes:

systemctl restart nginx

You can also check the Nginx status using the following command:

systemctl status nginx

You will get the following output:

? nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-11-12 14:06:21 UTC; 7s ago
       Docs: man:nginx(8)
    Process: 18137 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 18139 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 18140 (nginx)
      Tasks: 3 (limit: 464122)
     Memory: 3.4M
     CGroup: /system.slice/nginx.service
             ??18140 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
             ??18141 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
             ??18142 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

Nov 12 14:06:21 ubuntu22041 systemd[1]: Starting A high performance web server and a reverse proxy server...
Nov 12 14:06:21 ubuntu22041 systemd[1]: Started A high performance web server and a reverse proxy server.

Access WonderCMS Web Interface

Now, open your web browser and access the WonderCMS web interface using the URL http://wondercms.example.com. You should see the following screen containing login password:

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/02/echo/p1.png63f87a960c0be.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="382" loading="lazy" src="data:image/svg xml,” width=”750″>

Click on the CLICK HERE TO LOGIN. You should see the WonderCMS login page:

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/02/echo/p2.png63f87a963377f.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="354" loading="lazy" src="data:image/svg xml,” width=”750″>

Provide the login password and click on the LOGIN button. You should see the following page.

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/02/echo/p3.png63f87a965bfba.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="345" loading="lazy" src="data:image/svg xml,” width=”750″>

Click on the Security Setting to change the login URL as shown below:

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/02/echo/p4.png63f87a96a4cd4.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="387" loading="lazy" src="data:image/svg xml,” width=”750″>

Now, change the login URL, and customize your website as per your requirement.

Next, access the WonderCMS using the new URL http://wondercms.example.com/wonder. You should see the following page:

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/02/echo/p6.png63f87a971ad4e.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="344" loading="lazy" src="data:image/svg xml,” width=”750″>

Insert any content that you want to write. You should see the following page:

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/02/echo/p7.png63f87a9735749.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="349" loading="lazy" src="data:image/svg xml,” width=”750″>

Secure WonderCMS with Let’s Encrypt SSL

Next, you will need to install the Certbot client package to install and manage the Let’s Encrypt SSL. First, install the Certbot with the following command:

apt-get install python3-certbot-nginx -y

Once the installation is finished, run the following command to install the Let’s Encrypt SSL on your website:

certbot --nginx -d wondercms.example.com

You will be asked to provide a valid email address and accept the term of service as shown below:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for wondercms.example.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/conf.d/wondercms.conf

Next, choose whether or not to redirect HTTP traffic to HTTPS as shown below:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Type 2 and hit Enter to finish the installation. You should see the following output:

Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/wondercms.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://wondercms.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=wondercms.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/wondercms.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/wondercms.example.com/privkey.pem
   Your cert will expire on 2023-02-12. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

 - We were unable to subscribe you the EFF mailing list because your
   e-mail address appears to be invalid. You can try again later by
   visiting https://act.eff.org.

Conclusion

Congratulations! you have successfully installed WonderCMS with Nginx and Let’s Encrypt SSL on Ubuntu 22.04. You can now explore the WondoerCMS and start creating your own website via a web browser. Feel free to ask me if you have any questions.