How to Install WonderCMS on Ubuntu 18.04 LTS

Updated on November 21, 2023
How to Install WonderCMS on Ubuntu 18.04 LTS header image

WonderCMS is an open source, fast and small flat file CMS written in PHP. WonderCMS source code is hosted on Github. This guide will show you how to install WonderCMS on a fresh Ubuntu 18.04 LTS Vultr instance with Nginx as a web server.

Requirements

  • PHP version 7.1 or greater with the curl, mbstring and zip extensions.
  • Web server, such as Apache with mod_rewrite module enabled, Nginx or IIS. This guide will use Nginx.

Before you begin

Check the Ubuntu version.

lsb_release -ds
# Ubuntu 18.04.1 LTS

Create a new non-root user account with sudo access and switch to it.

adduser johndoe --gecos "John Doe"
usermod -aG sudo johndoe
su - johndoe

NOTE: Replace johndoe with your username.

Set up the timezone.

sudo dpkg-reconfigure tzdata

Ensure that your system is up to date.

sudo apt update && sudo apt upgrade -y

Install necessary packages.

sudo apt install -y zip unzip curl wget git

Install PHP

Install PHP, as well as the necessary PHP extensions.

sudo apt install -y php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-curl php7.2-zip php7.2-mbstring

Check the version.

php --version
# PHP 7.2.15-0ubuntu0.18.04.1 (cli) (built: Feb  8 2019 14:54:22) ( NTS )

Install Nginx

Install Nginx.

sudo apt install -y nginx

Check the version.

sudo nginx -v
# nginx version: nginx/1.14.0 (Ubuntu)

Run sudo vim /etc/nginx/sites-available/wondercms.conf and configure Nginx for WonderCMS.

server {
  
  listen 80;

  server_name example.com;
  root /var/www/wondercms;

  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/php7.2-fpm.sock;
  }

}

Save the file and exit.

Activate the new wondercms.conf configuration by linking the file to the sites-enabled directory.

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

Test the configuration.

sudo nginx -t

Reload Nginx.

sudo systemctl reload nginx.service

Install WonderCMS

Create a document root directory.

sudo mkdir -p /var/www/wondercms

Change ownership of the /var/www/wondercms directory to johndoe.

sudo chown -R johndoe:johndoe /var/www/wondercms

Navigate to the document root folder.

cd /var/www/wondercms

Download and unzip WonderCMS.

wget https://github.com/robiso/wondercms/releases/download/2.6.0/WonderCMS-2.6.0.zip
unzip WonderCMS-2.6.0.zip
rm WonderCMS-2.6.0.zip

Move WonderCMS files to the document root directory.

mv wondercms/* . && mv  wondercms/.* .
rmdir wondercms

Change ownership of the /var/www/wondercms directory to www-data.

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

Open your site in a web browser and log in with the default password admin and change the default password afterward.