How to Install WonderCMS with Nginx on Debian 9

WonderCMS is a free and open supply flat file CMS, aimed to be extraordinarily small, mild and easy. It is constructed with PHP, jQuery, HTML/CSS and developed since 2008. No preliminary configuration required. The set up course of is fairly easy – unzip and add 5 information. All information could be simply moved, backed up and restored by copy/pasting all information to a different location. Shifting them to a different host doesn’t require any re-configuration. WonderCMS additionally would not require a standard/relational database like MySQL. The flat file know-how permits WonderCMS to save lots of all information to a textual content file (flat file) referred to as database.js which is structured in JSON format. On this tutorial, we are going to undergo the WonderCMS set up and setup on the Debian 9 system by utilizing Nginx as an online server, and optionally you may safe the transport layer by utilizing Acme.sh consumer and Let’s Encrypt certificates authority so as to add SSL help.

Necessities

Necessities for putting in and working WonderCMS are:

  • PHP model 7.1 or higher with the curl, mbstring and zip extensions.
  • Web server (Apache with mod_rewrite module enabled, Nginx, IIS).

Stipulations

  • An Debian 9 working system.
  • A non-root person with sudo privileges.

Preliminary steps

Examine your Debian model:

lsb_release -ds
# Debian GNU/Linux 9.9 (stretch)

Arrange the timezone:

sudo dpkg-reconfigure tzdata

Replace your working system packages (software program). This is a vital first step as a result of it ensures you could have the most recent updates and safety fixes to your working system’s default software program packages:

sudo apt replace && sudo apt improve -y

Set up some important packages which might be mandatory for fundamental administration of the Debian working system:

sudo apt set up -y curl wget vim git unzip socat bash-completion apt-transport-https

Step 1 – Set up PHP and mandatory PHP extensions

Add third-party repo for PHP 7.2 set up:

sudo apt set up apt-transport-https lsb-release ca-certificates
wget -O /and many others/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /and many others/apt/sources.listing.d/php.listing
sudo apt replace

Set up PHP, in addition to the required PHP extensions:

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

To indicate PHP compiled in modules, you may run:

php -m

ctype
curl
exif
fileinfo
. . .
. . .

Examine the PHP model:

php --version

# PHP 7.2.17.18.04.1 (cli) (constructed: Apr 18 2019 14:12:38) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Applied sciences
# with Zend OPcache v7.2.10.debian.18.04.1, Copyright (c) 1999-2018, by Zend Applied sciences

PHP-FPM service is mechanically began and enabled on reboot on Debian 9 system, so there is no such thing as a want to begin and allow it manually. We are able to transfer on to the subsequent step, which is the SSL setup.

Step 2 – Set up acme.sh consumer and procure Let’s Encrypt certificates ( elective )

Securing your discussion board with HTTPS will not be mandatory, however it’s a good follow to safe your website visitors. With the intention to acquire a TLS certificates from Let’s Encrypt we are going to use Acme.sh consumer. Acme.sh is a pure UNIX shell software program for acquiring TLS certificates from Let’s Encrypt with zero dependencies.

Obtain and set up acme.sh:

sudo su - root
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
./acme.sh --install --accountemail [email protected]
supply ~/.bashrc
cd ~

Examine acme.sh model:

acme.sh --version
# v2.8.0

Get hold of RSA and ECC/ECDSA certificates to your area/hostname:

# RSA 2048
acme.sh --issue --standalone -d instance.com --keylength 2048
# ECDSA
acme.sh --issue --standalone -d instance.com --keylength ec-256

If you need pretend certificates for testing you may add --staging flag to the above instructions.

After working the above instructions, your certificates and keys will probably be in:

  • For RSA: /residence/username/instance.com listing.
  • For ECC/ECDSA: /residence/username/instance.com_ecc listing.

To listing your issued certs you may run:

acme.sh --list

Create a listing to retailer your certs. We’ll use /and many others/letsencrypt listing.

mkdir -p /and many others/letsecnrypt/instance.com
sudo mkdir -p /and many others/letsencrypt/instance.com_ecc

Set up/copy certificates to /and many others/letsencrypt listing.

# RSA
acme.sh --install-cert -d instance.com --cert-file /and many others/letsencrypt/instance.com/cert.pem --key-file /and many others/letsencrypt/instance.com/non-public.key --fullchain-file /and many others/letsencrypt/instance.com/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"
# ECC/ECDSA
acme.sh --install-cert -d instance.com --ecc --cert-file /and many others/letsencrypt/instance.com_ecc/cert.pem --key-file /and many others/letsencrypt/instance.com_ecc/non-public.key --fullchain-file /and many others/letsencrypt/instance.com_ecc/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"

All of the certificates will probably be mechanically renewed each 60 days.

After acquiring certs exit from root person and return again to regular sudo person:

exit

Step 3 – Set up and configure NGINX

WonderCMS can work fantastic with many fashionable internet server software program. On this tutorial, we chosen NGINX.

Set up NGINX:

sudo apt set up -y nginx

Examine the NGINX model:

sudo nginx -v
# nginx model: nginx/1.10.3

Subsequent, configure NGINX for WonderCMS. Run sudo vim /and many others/nginx/sites-available/wondercms.conf and add the next configuration:

server {
   
   hear 80;
   hear 443 ssl;

ssl_certificate /and many others/letsencrypt/instance.com/fullchain.cer;
ssl_certificate_key /and many others/letsencrypt/instance.com/instance.com.key;
ssl_certificate /and many others/letsencrypt/instance.com_ecc/fullchain.cer;
ssl_certificate_key /and many others/letsencrypt/instance.com_ecc/instance.com.key;
server_name instance.com; root /var/www/wondercms; index index.php; location / { if (!-e $request_filename) { rewrite ^/(.+)$ /index.php?web page=$1 final; } } location ~ database.js { return 403; } location ~ .php(/|$) { embrace snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; } }

Activate the brand new wondercms.conf configuration by linking the file to the sites-enabled listing:

sudo ln -s /and many others/nginx/sites-available/wondercms.conf /and many others/nginx/sites-enabled/

Examine NGINX configuration for syntax errors:

sudo nginx -t

Reload NGINX service:

sudo systemctl reload nginx.service

Step 4 – Set up WonderCMS

Create a doc root listing for WonderCMS.

sudo mkdir -p /var/www/wondercms

Change possession of the /var/www/wondercms listing to [jour_username]:

sudo chown -R [your_username]:[your_username] /var/www/wondercms

Navigate to the doc root listing:

cd /var/www/wondercms

Obtain and unzip WonderCMS supply:

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

Transfer WonderCMS information to doc root listing.

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

Change possession of the /var/www/wondercms listing to www-data:

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

Open your website in an online browser and log in with default password admin and alter the default password afterward.

WonderCMS on Debian Linux

Hyperlinks

LEAVE A REPLY

Please enter your comment!
Please enter your name here