October is a free, open-source, and self-hosted content management system (CMS) written in PHP. It is based on the Laravel web application framework and supports MySQL, MariaDB, and PostgreSQL database backends. It is designed for beginner users and allows developers to build advanced web applications with convenience and ease. It offers innovative web features and has a large community of users around the world.

In this tutorial, we will show you how to install October CMS with Nginx on Oracle Linux 8.

Step 1 – Install Nginx, MariaDB and PHP

First, you will need to install the Nginx web server, MariaDB database, PHP, and other required extensions on your server. Run the following command to install all of them:

dnf install nginx mariadb-server php php-cli php-fpm php-pdo php-common php-mysqlnd php-curl php-json php-zip php-gd php-xml php-mbstring git unzip -y

After installing all the components, edit the PHP-FPM configuration file and change the user and group from apache to nginx:

nano /etc/php-fpm.d/www.conf

Change the following lines:

user = nginx
group = nginx

Save and close the file, then start and enable the Nginx, MariaDB, and PHP-FPM services:

systemctl start nginx php-fpm mariadb
systemctl enable nginx php-fpm mariadb

Step 2 – Create a Database for October CMS

Next, you will need to create a database and user to store content.

First, log in to the MariaDB shell using the following command:

mysql

Once you are connected to MariaDB, create a database and user with the following command:

CREATE DATABASE october;
GRANT ALL ON october.* TO 'october' IDENTIFIED BY 'password';

Next, flush the privileges and exit from the MariaDB shell with the following command:

FLUSH PRIVILEGES;
EXIT;

Step 3 – Install October CMS

First, download the latest version of October CMS from their official website using the wget command:

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

Once the download is completed, unzip the downloaded file with the following command:

unzip october.zip

Next, move the extracted directory to the Apache web root:

mv install-master /var/www/html/october

Next, change the ownership and permissions of the October CMS directory:

chown -R nginx:nginx /var/www/html/october
chmod -R 775 /var/www/html/october

Step 4 – Create an Nginx Virtual Host for October CMS

First, create an Nginx virtual host configuration file for October CMS using the following command:

nano /etc/nginx/conf.d/october.conf

Add the following lines:

    server {
        listen       80;
        server_name  october.example.com;
        root         /var/www/html/october;

        index index.php index.html;
        location / {
                try_files $uri /index.php$is_args$args;
        }
        location ~ \.php$ {
           fastcgi_pass unix:/run/php-fpm/www.sock;
           fastcgi_index index.php;
           fastcgi_read_timeout 240;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
           include fastcgi_params;
               fastcgi_split_path_info ^(.+.php)(/.+)$;
        }

            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;
    }

Save and close the file, then edit the Nginx configuration file and define the hash bucket size:

nano /etc/nginx/nginx.conf

Add the following line below the line http{:

server_names_hash_bucket_size 64;

Save and close the file then verify the Nginx for any syntax error:

nginx -t

You should get the following output:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Finally, restart the Nginx and PHP-FPM services to apply the changes:

systemctl restart nginx php-fpm

Step 5 – Access October CMS

Now, open your web browser and access the October CMS web UI using the URL http://october.example.com/install.php. You should see the system check page:
October system check page
If all checks are successful, click on the Continue button. You should see the database configuration page:
October database configuration page
Provide your database configuration and click on the Administrator button. You should see the following page:
October admin configuration page
Provide your administrative user details and click on the Continue button. Once the October CMS is installed, you should see the following page:
October installation finished page
Click on the link below the Administration Area. You should see the October CMS login page:
October login page
Provide your admin username and password and click on the Login button. You should see the October CMS dashboard on the following page:
October dashboard page

Conclusion

In this tutorial, we showed you how to install and configure October CMS with Nginx on Oracle Linux 8. You can now host your own website easily using the October CMS. Try it on dedicated hosting from Atlantic.Net!