Blog

How to Install Bludit CMS with NGINX on CentOS 7

Bludit is a simple, fast, secure, flat-file CMS that allows you to create your own website or blog in seconds. It’s completely free and open source. You can browse its source code on Github. Bludit uses files in JSON format to store the content, you don’t need to install or configure a database. You only need a web server with PHP support. Bludit incorporates all the SEO tools to improve your ranking in all the search engines and social networks. It has a rich themes and plugins system that you can use to change the look and feel of your site. In this tutorial, we will go through the Bludit CMS installation and setup on CentOS 7 system by using NGINX as a web server.

Requirements

Make sure your system meets the following requirements:

  • PHP version 5.3 or greater with the following extensions: mbstring, gd, dom and JSON.
  • A web server with PHP support like Nginx, Apache, Lighttpd, H2O. This tutorial will use NGINX.

Prerequisites

  • A system running CentOS 7.
  • A non-root user with sudo privileges.

Initial steps

Check your CentOS version:

cat /etc/centos-release
# CentOS Linux release 7.6.1810 (Core)

Set up the timezone:

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

Update your operating system packages (software). This is an important first step because it ensures you have the latest updates and security fixes for your operating system’s default software packages:

sudo yum update -y

Install some essential packages that are necessary for basic administration of the CentOS operating system:

sudo yum install -y curl wget vim git unzip socat bash-completion epel-release

Step 1 – 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-mbstring php72w-zip php72w-pgsql php72w-sqlite3 php72w-curl php72w-gd php72w-mysql php72w-intl php72w-json php72w-opcache php72w-xml

To show PHP compiled in modules, you can run:

php -m

ctype
curl
exif
fileinfo
. . .
. . .

Check the PHP version:

php --version
# PHP 7.2.14 (cli) (built: Jan 12 2019 12:47:33) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
#     with Zend OPcache v7.2.14, Copyright (c) 1999-2018, by Zend Technologies

Start and enable PHP-FPM service:

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

Step 2 – Install acme.sh client and obtain Let’s Encrypt certificate (optional)

Securing your website with HTTPS is not necessary, but it is a good practice to secure your site traffic. In order to obtain a TLS certificate from Let’s Encrypt we will use Acme.sh client. Acme.sh is a pure Unix shell software for obtaining TLS certificates from Let’s Encrypt with zero dependencies.

Download and install Acme.sh:

sudo mkdir /etc/letsencrypt
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh 
sudo ./acme.sh --install --home /etc/letsencrypt --accountemail [email protected]
cd ~

Check Acme.sh version:

/etc/letsencrypt/acme.sh --version
# v2.8.0

Obtain RSA and ECC/ECDSA certificates for your domain/hostname:

# RSA 2048
sudo /etc/letsencrypt/acme.sh --issue --standalone --home /etc/letsencrypt -d example.com --keylength 2048
# ECDSA
sudo /etc/letsencrypt/acme.sh --issue --standalone --home /etc/letsencrypt -d example.com --keylength ec-256

After running the above commands, your certificates and keys will be in:

  • For RSA: /etc/letsencrypt/example.com directory.
  • For ECC/ECDSA: /etc/letsencrypt/example.com_ecc directory.

Step 3 – Install and configure NGINX

Download and install Nginx from the CentOS repository:

sudo yum install -y nginx

Check the Nginx version:

nginx -v
# nginx version: nginx/1.12.2

Start and enable Nginx service:

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

Configure NGINX for Bludit by running:

sudo vim /etc/nginx/conf.d/bludit.conf

And populate the file with the following configuration:

server {
  listen 80;
  listen 443 ssl;

ssl_certificate /etc/letsencrypt/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com/private.key;
ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com_ecc/private.key;
server_name example.com; root /var/www/bludit; index index.php; location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } location / { try_files $uri $uri/ /index.php?$args; } location ^~ /bl-content/tmp/ { deny all; } location ^~ /bl-content/pages/ { deny all; } location ^~ /bl-content/databases/ { deny all; } }

Check NGINX configuration for syntax errors:

sudo nginx -t

Reload NGINX service:

sudo systemctl reload nginx.service

Step 4 – Install Bludit

Create a document root directory where Bludit should reside in:

sudo mkdir -p /var/www/bludit

Change ownership of the /var/www/bludit directory to [your_user]:

sudo chown -R [your_user]:[your_user] /var/www/bludit

Navigate to document root:

cd /var/www/bludit

Download the latest version from the official page and extract the zip file:

wget https://www.bludit.com/releases/bludit-3-8-1.zip
unzip bludit-3-8-1.zip
rm bludit-3-8-1.zip
mv bludit-3-8-1/* .  mv bludit-3-8-1/.* .
rmdir bludit-3-8-1

NOTE: Update download URL if there is a newer release.

Provide the appropriate ownership:

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

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

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

Restart PHP-FPM service:

sudo systemctl restart php-fpm.service

Step 5 – Complete the Bludit installation wizard

Open your site in a web browser. After opening your site in a web browser, you should be redirected to the following page, to choose your language:

Bludit Installer

Next, create a password for the user admin, and click “Install”:

Set Admin password

After creating an admin password, you will be redirected to the Bludit frontend:

Welcome to Bludit

To access Bludit admin area, append /admin to your site IP or URL. This is how Bludit admin looks like:

Bludit CMS Dashboard

Installation is complete. Happy blogging with Bludit CMS.