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 CentOS 7 Rcs instance with Nginx as a web server.
Requirements
- PHP version 7.1 or greater with the
curl
,mbstring
andzip
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 CentOS version.
cat /etc/centos-release
# CentOS Linux release 7.6.1810 (Core)
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 yum check-update; sudo yum update -y
Install some basic system administration packages if they are not installed.
sudo yum install -y vim curl wget git unzip bash-completion epel-release
For simplicity, disable SELinux and Firewall.
sudo setenforce 0;sudo systemctl stop firewalld;sudo systemctl disable firewalld
Install PHP
Setup the Webtatic YUM repo.
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Install PHP, as well as the necessary PHP extensions.
sudo yum install -y php72w php72w-cli php72w-fpm php72w-common php72w-curl php72w-zip php72w-mbstring php72w-json
Check the version.
php --version
Start and enable PHP-FPM.
sudo systemctl start php-fpm.service
sudo systemctl enable php-fpm.service
Install Nginx
Install Nginx.
sudo yum install -y nginx
Check the version.
nginx -v
# nginx version: nginx/1.12.2
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(/|$) {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
}
}
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.