How to Install WonderCMS on Fedora 29

Published on: Fri, Jun 14, 2019 at 11:23 am EST
CMS Fedora Linux Guides Server Apps

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 Fedora 29 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 the mod_rewrite module enabled, Nginx or IIS. This guide will use Nginx.

Before you begin

Check the Fedora version.

cat /etc/fedora-release
# Fedora release 29 (Twenty Nine)

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

useradd -c "John Doe" johndoe && passwd johndoe
usermod -aG wheel johndoe
su - johndoe

NOTE: Replace johndoe with your username.

Set up the timezone.

timedatectl list-timezones
sudo timedatectl set-timezone 'Region/City'

Ensure that your system is up to date.

sudo dnf check-update; sudo dnf update -y

Install some basic system administration packages if they are not installed.

sudo dnf install -y vim curl wget git unzip bash-completion

For simplicity, disable SELinux and Firewall.

sudo setenforce 0;sudo systemctl stop firewalld;sudo systemctl disable firewalld

Install PHP

Install PHP, as well as the necessary PHP extensions.

sudo dnf install -y php-cli php-fpm php-common php-curl php-zip php-mbstring php-json

Check the version.

php --version
# PHP 7.2.15 (cli) (built: Feb  5 2019 15:43:35) ( NTS )

Start and enable PHP-FPM.

sudo systemctl start php-fpm.service
sudo systemctl enable php-fpm.service

Install Nginx

Install Nginx.

sudo dnf install -y nginx

Check the version.

nginx -v
# nginx version: nginx/1.14.1

Start and enable Nginx.

sudo systemctl start nginx.service
sudo systemctl enable nginx.service

Run sudo vim /etc/nginx/conf.d/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 default.d/php.conf;
    fastcgi_pass unix:/run/php-fpm/www.sock;
  }

}

Save the file and exit.

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

Create a new directory called /var/lib/php/session/ and change the ownership to nginx.

sudo mkdir -p /var/lib/php/session/ && sudo chown -R nginx:nginx /var/lib/php/session/

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

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

Run sudo vim /etc/php-fpm.d/www.conf and set the user and group to nginx. Initially, it will be set to apache.

sudo vim /etc/php-fpm.d/www.conf
# user = nginx
# group = nginx

Restart PHP-FPM.

sudo systemctl restart php-fpm.service

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

Want to contribute ?

You could earn up to $300 by adding new articles