How to Install PyroCMS with Nginx and Let’s Encrypt SSL on CentOS 8

How to Install PyroCMS with Nginx and Let's Encrypt SSL on CentOS 8

PyroCMS is a powerful modular CMS and development platform built with Laravel 5, which allows you to build Laravel websites and applications faster.

In this tutorial, we will guide you through the PyroCMS installation process on the CentOS 8 operating system by using NGINX as a web server, MariaDB as a database server, and optionally you can secure the transport layer by using the client and Let’s Encrypt certificate authority to add SSL support.


To install PyroCMS, make sure your system meets the following requirements:

  • At least 1GB of RAM or swap is configured.
  • PHP version 7.0 or greater with PDO, cURL, SQLite, OpenSSL, Mbstring, Fileinfo, Tokenizer, PHP GD extension.
  • MariaDB


  • Systems running the CentOS 8 system.
  • Non-root user with sudo rights.

Initial step

Check your version of CentOS:

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

Set up time zone:

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

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

sudo dnf update -y

Install some of the important packages needed for basic administration of the CentOS operating system:

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

Step 1 – Install PHP and PHP extensions as needed

Download and install the required PHP and PHP extensions:

sudo dnf install -y php php-cli php-fpm php-mysqlnd php-curl php-sqlite3 php-mbstring php-gd php-xml

To show PHP compiled in modules, you can run:

php -m

. . .
. . .

Check the PHP version:

php --version
# PHP 7.2.11 (cli) (built: Oct  9 2018 15:09:36) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Start and activate the PHP-FPM service:

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

Step 2 – Install MariaDB and create a database for PyroCMS

Install MariaDB:

sudo dnf install -y mariadb-server mariadb-client

Check the MariaDB version:

mysql --version
# mysql  Ver 15.1 Distrib 10.3.17-MariaDB, for Linux (x86_64) using readline 5.1

Start and activate the MariaDB service:

sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Run the mysql_secure installation script to increase MariaDB security and set a password for MariaDB root users:

sudo mysql_secure_installation

Answer each question:

Enter current password for root (enter for none): Press Enter
Set root password? [Y/n] Y
New password: your_secure_password
Re-enter new password: your_secure_password
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Enter MariaDB as the root user:

sudo mysql -u root -p
# Enter password

Create a MariaDB database and user that you will use for your PyroCMS installation, and remember the credentials:

GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';

Change the dbname and username with the appropriate names for your settings. Change the password with a strong password.

Exit the MariaDB shell:


Step 3 – Install the client and get the Let’s Encrypt certificate (optional)

Securing your website with HTTPS is not necessary, but it is a good practice to secure your site’s traffic. To get an SSL certificate from the client. is a pure UNIX shell software for getting SSL certificates from Let’s Encrypt with zero dependencies.

Download and install

sudo su - root
git clone
./ --install --accountemail
source ~/.bashrc
cd ~

Check the version: --version
# v2.8.6

Get RSA and ECC / ECDSA certificates for your domain / host name:

# RSA 2048 --issue --standalone -d --keylength 2048
# ECDSA --issue --standalone -d --keylength ec-256

If you want a fake certificate for testing, you can add the –staging flag to the above command.

To register a certificate issued, you can run: --list

Create a directory to store your certificates. We will use the / etc / letsencrypt directory.

mkdir -p /etc/letsencrypt/
sudo mkdir -p /etc/letsencrypt/example.com_ecc

Install / copy the certificate to the / etc / letsencrypt directory.

# RSA --install-cert -d \ 
        --cert-file /etc/letsencrypt/ \
        --key-file /etc/letsencrypt/ \
        --fullchain-file /etc/letsencrypt/ \
        --reloadcmd "sudo systemctl reload nginx.service"

# ECC/ECDSA --install-cert -d --ecc \
        --cert-file /etc/letsencrypt/example.com_ecc/cert.pem \
        --key-file /etc/letsencrypt/example.com_ecc/private.key \
        --fullchain-file /etc/letsencrypt/example.com_ecc/fullchain.pem \
        --reloadcmd "sudo systemctl reload nginx.service"

After executing the above command, your certificate and key will be at:

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

All certificates will be renewed automatically every 60 days.

After getting the certificate, exit the root user and return to the normal sudo user:


Step 4 – Install NGINX and configure NGINX for PyroCMS

Install the NGINX web server:

sudo dnf install -y nginx

Check the NGINX version:

nginx -v
# nginx version: nginx/1.14.1

Start and activate the Nginx service:

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

Configure NGINX for PyroCMS by running:

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

And fill the file with the following configuration:

server {
  listen 80;
  listen 443 ssl;
  index index.php index.html;
  root /var/www/pyro/public;

  ssl_certificate /etc/letsencrypt/;
  ssl_certificate_key /etc/letsencrypt/;
  ssl_certificate /etc/letsencrypt/status.example.com_ecc/fullchain.cer;
  ssl_certificate_key /etc/letsencrypt/status.example.com_ecc/;
  location / {
    try_files $uri $uri/ /index.php?$args;

  location ~ \.php$ {
    include fastcgi_params;
    fastcgi_pass unix:/run/php-fpm/www.sock;;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_index index.php;

Check the NGINX configuration for syntax errors:

sudo nginx -t

Reload NGINX service:

sudo systemctl reload nginx.service

Step 5 – Install Composer

Install Composer, a PHP dependency manager globally:

php -r "copy('', 'composer-setup.php');"

php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php

php -r "unlink('composer-setup.php');"

sudo mv composer.phar /usr/local/bin/composer

Check the Composer version:

composer --version
# Composer version 1.10.5 2012-04-02 10:52:10

Step 6 – Install PyroCMS

Create the document root directory where PyroCMS should be:

sudo mkdir -p /var/www/pyro

Change the ownership of the / var / www / pyro directory to your username that you should have previously created and you must be logged in as this user.

sudo chown -R your_username:your_username /var/www/pyro

NOTE: Don’t forget to replace your username with the name you chose.

Navigate to the root document:

cd /var/www/pyro

Download the latest stable release of PyroCMS via composer:

composer create-project pyrocms/pyrocms .

Change ownership of the /var/www/pyro directory to www-data.

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

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

sudo vim /etc/php-fpm.d/www.conf

And set users and groups to nginx, as below:

user = nginx
group = nginx

And finally, restart PHP-FPM service for these changes to take effect:

sudo systemctl restart php-fpm.service

Step 7 – Complete the PyroCMS settings

Access your site in a web browser via a domain name or IP address and follow the PyroCMS web installation guide.


After you have filled out all the necessary information, your PyroCMS installation is complete.

Related posts

How to Install Atom Text Editor on Ubuntu 20.04


How to Change the Directory Name in Linux


How to Get Windows Terminal Fonts (Cascadia Code) on an Ubuntu Terminal


How to Install Vagrant on Ubuntu 20.04


How to Install Sensu Monitoring on Ubuntu 20.04


How to Install PostgreSQL and phpPgAdmin on Ubuntu 20.04 LTS


How to Install Memcached on Ubuntu 20.04 LTS


How to Install Joomla with Apache2 and Let’s Encrypt on Ubuntu 20.04


How to integrate the ONLYOFFICE editor with the Nuxeo Platform