In this tutorial, we are going to install WonderCMS on Ubuntu 22.04, and we will use Nginx as a web server.
WonderCMS is a content management system written in PHP that uses javascript, jQuery, and CSS. This software does not require a traditional database system like MySQL or SQLite, and the data is saved in a small text file called a flat file.
Installing WonderCMS on Ubuntu 22.04 with Nginx as a web server is a very easy process that can take up to 10 minutes. Let’s get started!
Table of Contents
Prerequisites
- A server with Ubuntu 22.04 as OS
- A valid domain name pointed to the server IP address
- User privileges: root or non-root user with sudo privileges
Step 1. Update the System
Every fresh installation of Ubuntu 22.04 needs the packages to be updated to the latest versions available.
sudo apt-get update -y && sudo apt-get upgrade -y
Step 2. Install Nginx Web Server
Nginx Web server can be installed with the following command:
sudo apt-get install nginx -y
Once installed, start and enable the service.
sudo systemctl enable nginx.service && sudo systemctl start nginx.service
Check if the service is up and running:
sudo systemctl status nginx.service
You should receive the following output:
root@host:~# sudo systemctl status nginx.service ● 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 Tue 2022-06-28 20:42:37 UTC; 2s ago Docs: man:nginx(8) Process: 129015 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Process: 129016 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Main PID: 129017 (nginx) Tasks: 5 (limit: 4579) Memory: 4.8M CPU: 353ms CGroup: /system.slice/nginx.service ├─129017 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;" ├─129018 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ├─129019 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ├─129020 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" └─129021 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Jun 28 20:42:37 host.test.vps systemd[1]: Starting A high performance web server and a reverse proxy server... Jun 28 20:42:37 host.test.vps systemd[1]: Started A high performance web server and a reverse proxy server.
Step 3. Install PHP with extensions
To install PHP8.1 with extensions, execute the following commands:
sudo apt-get install php8.1 php8.1-fpm php8.1-cli php8.1-common php8.1-imap php8.1-redis php8.1-snmp php8.1-xml php8.1-zip php8.1-mbstring php8.1-curl
Once the PHP extensions are installed, we need to check if the PHP-FPM service is up and running with the command below:
sudo systemctl status php8.1-fpm.service
If the service is up and running, you should receive the following output:
root@host:~# sudo systemctl status php8.1-fpm.service ● php8.1-fpm.service - The PHP 8.1 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php8.1-fpm.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2022-06-28 20:44:59 UTC; 15min ago Docs: man:php-fpm8.1(8) Process: 130885 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/8.1/fpm/pool.d/www.conf 81 (code=exited, status=0/SUCCESS) Main PID: 130881 (php-fpm8.1) Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec" Tasks: 3 (limit: 4579) Memory: 10.6M CPU: 760ms CGroup: /system.slice/php8.1-fpm.service ├─130881 "php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf)
Step 4. Download and Install WonderCMS
Go into the default Nginx document root directory and clone the WonderCMS installation from Github.
cd /var/www/html git clone https://github.com/robiso/wondercms.git .
Set the correct file and folder permissions:
chown -R www-data:www-data . find . -type d -exec chmod 755 {} \; find . -type f -exec chmod 644 {} \;
Step 5. Create Nginx Virtual Host
Go into the Nginx configuration directory and create the file.
cd /etc/nginx/sites-available touch wondercms.conf
Open the file with your favorite editor and paste the following lines of code:
server { listen 80; server_name yourdomain.com; root /var/www/html; index index.php; location / { if (!-e $request_filename) { rewrite ^/(.+)$ /index.php?page=$1 last; } } location ~ database.js { return 403; } location ~ \.php(/|$) { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; } }
Enable the newly created Nginx configuration file with a symbolic link as described below:
ln -s /etc/nginx/sites-available/wondercms.conf /etc/nginx/sites-enabled/
Check the Nginx syntax with the command below:
nginx -t
If everything is OK, you should receive the following output:
root@host:/etc/nginx/sites-available# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Now, you can restart the Nginx service and access your application in your browser at http://yourdomain.com
sudo systemctl restart nginx.service
There will be a randomly generated password displayed on the page to log in to the backend of WonderCMS. Login and change the randomly generated password.
Congratulations! You successfully installed and configured WonderCMS with Nginx as a web server on Ubuntu 22.04 OS.
If you do not know how to proceed further with changing the password and setting up some basic settings related to the server, you can always contact our technical support. We are available 24/7.
If you liked this post on how to install WonderCMS on Ubuntu 22.04, please share it with your friends on social networks or simply leave a reply below. Thanks.