How to Install October CMS with Nginx on Fedora 29

October CMS is a free, open-source, self-hosted CMS platform based on the Laravel PHP Framework. October CMS source code is hosted on Github. Thousands of digital studios and freelancers all over the world love October for its simplicity, flexibility, and modern design. In this tutorial, we will go through the October CMS installation on Fedora 29 system by using Nginx as a web server, MariaDB as a database server, and optionally you can secure transport layer by using acme.sh client and Let's Encrypt certificate authority to add SSL support.

Requirements

Before you proceed, you should check that your server meets the minimum system requirements. October CMS has the following server requirements for web hosting:

  • PHP version 7.0 or greater
  • PHP PDO Extension
  • cURL PHP Extension
  • OpenSSL PHP Extension
  • Mbstring PHP Library
  • Zip PHP Library
  • GD PHP Library
  • XML PHP Extension
  • JSON PHP Extension
  • Apache with mod_rewrite or Nginx

Prerequisites

  • A system running Fedora 29.
  • A non-root user with sudo privileges.

Initial steps

Check your Fedora system version:

cat /etc/fedora-release
# Fedora release 29 (Twenty Nine)

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 dnf upgrade -y

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

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

Step 1 - Install PHP

October CMS platform requires PHP version 7.0 or greater.

Install PHP, as well as the necessary PHP extensions:

sudo dnf install -y php-cli php-fpm php-pdo php-common php-mysqlnd php-curl php-json php-zip php-gd php-xml php-mbstring 

Check the PHP version:

php --version

# PHP 7.2.15 (cli) (built: Feb  5 2019 15:43:35) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies # with Zend OPcache v7.2.9, 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

We can move on to the next step, which is the database installation and setup.

Step 2 - Install MariaDB and create a database for October

Install MariaDB database server:

sudo dnf install -y mariadb-server

Check the MariaDB version:

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

Start and enable MariaDB service:

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

Run mysql_secure installation script to improve MariaDB security and set the password for MariaDB root user:

mysql_secure_installation

Log into MariaDB as the root user:

mysql -u root -p
# Enter password

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

CREATE DATABASE dbname;
GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

Exit from MariaDB shell:

quit

Step 3 - 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 an SSL certificate from Let's Encrypt we will use Acme.sh client. Acme.sh is a pure UNIX shell software for obtaining SSL 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 4 - Install and configure NGINX

Install the NGINX web server:

sudo dnf install -y nginx

Check the NGINX version:

nginx -v
# nginx version: nginx/1.14.1

Start and enable NGINX service:

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

Run sudo vim /etc/nginx/conf.d/october.conf and populate the file with the following configuration:

server {
listen [::]:443 ssl http2;
listen 443 ssl http2; listen [::]:80; listen 80; server_name example.com; index index.php index.html; root /var/www/october;
ssl_certificate /etc/letsencrypt/example.com/fullchain.cer;
ssl_certificate_key /etc/letsencrypt/example.com/example.com.key;
ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.cer;
ssl_certificate_key /etc/letsencrypt/example.com_ecc/example.com.key;
location / { try_files $uri /index.php$is_args$args; } location ~ \.php$ { include default.d/php.conf; include fastcgi_params; fastcgi_pass unix:/run/php-fpm/www.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_read_timeout 120s; } rewrite ^themes/.*/(layouts|pages|partials)/.*.htm /index.php break; rewrite ^bootstrap/.* /index.php break; rewrite ^config/.* /index.php break; rewrite ^vendor/.* /index.php break; rewrite ^storage/cms/.* /index.php break; rewrite ^storage/logs/.* /index.php break; rewrite ^storage/framework/.* /index.php break; rewrite ^storage/temp/protected/.* /index.php break; rewrite ^storage/app/uploads/protected/.* /index.php break; }

Test the NGINX configuration:

sudo nginx -t

Reload NGINX:

sudo systemctl reload nginx.service

Step 5 - Download and install October CMS platform

Create a document root directory:

sudo mkdir -p /var/www/october

Change ownership of the /var/www/october directory to johndoe:

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

Navigate to document root:

cd /var/www/october

Download the October CMS installer:

wget http://octobercms.com/download -O october.zip

Unzip October CMS installer:

unzip october.zip
rm october.zip
mv install-master/* .

Change ownership of the /var/www/october directory to nginx:

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

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 the PHP-FPM service:

sudo systemctl restart php-fpm.service

Navigate to the install.php script in your web browser, like example.com/install.php and follow the installation instructions.

Step 6 - Complete the October setup

Make sure your System Check is ok and proceed by pressing the "Agree & Continue" button.

October CMS setup

Configure your database and admin user settings.

Database settings

Administrator user setup

You can also configure some advanced settings or you can leave the default values.

Advanced settings

And finally when everything is configured press blue "Continue" button.

Next, you will be asked, "How do you want to set up your site?". You will have 3 options: Start from scratch, Start from a theme, Use a project ID. Select your preferred option.

Getting Started with October CMS

To access the administration area of October CMS platform, just append /backend to your URL/IP.

After the installation, for security reasons you should delete the installation files, the install.php script and the install_files directory:

sudo rm /var/www/october/install.php && sudo rm -rf /var/www/october/install_files

Links

Share this page:

1 Comment(s)