How to Install October CMS with Nginx on Fedora 29

How to Install October CMS with Nginx on Fedora 29

October CMS is a free, open source, self-hosted CMS platform based on Laravel PHP Framework. October CMS source code is hosted on Github. Thousands of digital studios and freelancers around the world love October for its simplicity, flexibility, and modern design. In this tutorial, we will use Nginx as the web server and MariaDB as the database server to complete the October CMS installation on a Fedora 29 system, and you can choose to use the acme.sh client and “ Let’s add the certificate authority ” To protect transport layer SSL support.

Claim

Before proceeding, you should check that the server meets the minimum system requirements. October CMS has the following server requirements for virtual hosts:

  • PHP 7.0 or higher
  • 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 mod_rewrite Or Nginx

prerequisites

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

Preliminary steps

Check your Fedora system version:

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

Set time zone:

timedatectl list-timezonessudo 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 the operating system’s default packages:

sudo dnf upgrade -y

Install some basic packages that are required for basic management 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 7.0 or higher.

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

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

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

Step 2-install MariaDB and create database for October

Install MariaDB database server:

sudo dnf install -y mariadb-server

Check 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.servicesudo systemctl enable mariadb.service

Run mysql_secure installation Script to increase MariaDB security and set a password for MariaDB root user:

mysql_secure_installation

Log in to MariaDB as the root user:

mysql -u root -p# Enter password

Create the MariaDB database and user that will be used for the October installation, and remember the credentials:

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

Exit from the MariaDB shell:

quit

Step 3-Install Acme.sh Client and Obtain “Let’s Encrypt” Certificate (Optional)

You don’t have to use HTTPS to protect your website, but it is a good habit to protect your website traffic. To get an SSL certificate from Let’s Encrypt, we will use the 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/letsencryptgit clone https://github.com/Neilpang/acme.sh.gitcd acme.sh sudo ./acme.sh --install --home /etc/letsencrypt --accountemail [email protected]cd ~

Check the Acme.sh version:

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

Gain RSA with ECC / ECDSA Your domain / hostname certificate:

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

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

  • For RSA: /etc/letsencrypt/example.com table of Contents.
  • For ECC / ECDSA: /etc/letsencrypt/example.com_ecc table of Contents.

Step 4-install and configure NGINX

Install NGINX Web Server:

sudo dnf install -y nginx

Check NGINX version:

nginx -v# nginx version: nginx/1.14.1

Start and enable the NGINX service:

sudo systemctl start nginx.servicesudo 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 the October CMS platform

Create a document root directory:

sudo mkdir -p /var/www/october

Change ownership /var/www/october Directory to johndoe:

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

Navigate to the document root:

cd /var/www/october

Download the October CMS installer:

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

Extract the October CMS installer:

unzip october.ziprm october.zipmv install-master/* .

Change ownership /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 users and groups 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 install.php A script in a web browser, such as example.com/install.php And follow the installation instructions.

Step 6-Complete the October setup

Make sure the system check is normal, then press “Agree and continue“Button.

Configure database and administrator user settings.

Database settings

Administrator user settings

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

advanced settings

Finally, after everything is configured, press the blue “carry on“Button.

Next, you will be asked,How would you like to set up your website?“. You will have 3 options: start from scratch, start with theme, use project ID. Choose your preferred option.

Getting started with October CMS

To access the management area of ​​the October CMS platform, simply add /backend To your URL / IP.

After installation, you should delete the installation files for security reasons, install.php Script and install_files table of Contents:

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

link

  • https://octobercms.com/
  • https://github.com/octobercms/october
Sidebar