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,mbstringandzipextensions. - Web server such as Apache with the
mod_rewritemodule 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 - johndoeNOTE: 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 -yInstall some basic system administration packages if they are not installed.
sudo yum install -y vim curl wget git unzip bash-completion epel-releaseFor simplicity, disable SELinux and Firewall.
sudo setenforce 0;sudo systemctl stop firewalld;sudo systemctl disable firewalldInstall PHP
Setup the Webtatic YUM repo.
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpmInstall 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-jsonCheck the version.
php --versionStart and enable PHP-FPM.
sudo systemctl start php-fpm.service
sudo systemctl enable php-fpm.serviceInstall Nginx
Install Nginx.
sudo yum install -y nginxCheck the version.
nginx -v
# nginx version: nginx/1.12.2Start and enable Nginx.
sudo systemctl start nginx.service
sudo systemctl enable nginx.serviceRun 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 -tReload Nginx.
sudo systemctl reload nginx.serviceInstall WonderCMS
Create a document root directory.
sudo mkdir -p /var/www/wondercmsChange ownership of the /var/www/wondercms directory to johndoe.
sudo chown -R johndoe:johndoe /var/www/wondercmsNavigate to the document root folder.
cd /var/www/wondercmsDownload 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.zipMove WonderCMS files to the document root directory.
mv wondercms/* . && mv wondercms/.* .
rmdir wondercmsCreate 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/wondercmsRun 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 = nginxRestart PHP-FPM.
sudo systemctl restart php-fpm.serviceOpen your site in a web browser and log in with the default password admin and change the default password afterward.