Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install October CMS on Linux (Nginx, MariaDB, PHP)

Set up a LEMP stack, create a database, install October CMS and finish in the browser.

CMS and Apps3 min read15 screenshots

Step 1: Set up the LEMP stack

Update the system:

sudo apt update && sudo apt upgrade -y
Updating the system

Install Nginx, MariaDB and PHP (with the PHP-FPM and the extensions that October CMS needs):

sudo apt install nginx mariadb-server php php-fpm php-mysql php-curl php-gd php-mbstring php-xml php-zip php-intl unzip -y
Installing Nginx, MariaDB and PHP
  • Nginx is the web server that serves October CMS.
  • MariaDB is the MySQL-compatible database.
  • PHP (with PHP-FPM) runs the PHP files.

Start the services and enable them at boot:

sudo systemctl start nginx mariadb && sudo systemctl enable nginx mariadb
Starting Nginx and MariaDB

Step 2: Set up the database

Secure the database server:

sudo mysql_secure_installation
Running mysql_secure_installation

Open the shell:

sudo mysql
Opening the MariaDB shell

Create the database and the user:

CREATE DATABASE octobercms;
CREATE USER 'octoberuser'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON octobercms.* TO 'octoberuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
  • CREATE DATABASE makes a database for the CMS.
  • CREATE USER makes a user with a password.
  • GRANT ALL PRIVILEGES gives that user all rights on that database only.
  • FLUSH PRIVILEGES makes the changes active.

Step 3: Download October CMS

cd /var/www/html
Moving to the web folder

Download the October CMS installer package from the October CMS website:

sudo wget https://octobercms.com/download -O october.zip
Downloading October CMS

Unzip it:

sudo unzip october.zip
Unzipping the archive

Rename the extracted folder (the name depends on the package):

sudo mv install-master octobercms
Renaming the folder

Set the owner and the permissions:

sudo chown -R www-data:www-data /var/www/html/octobercms
sudo chmod -R 755 /var/www/html/octobercms
Setting the owner and the permissions

Step 4: Configure Nginx

Create the server block:

sudo nano /etc/nginx/sites-available/octobercms.conf

Add (change the domain and the PHP socket to match your PHP version; check ls /var/run/php/):

server {
    listen 80;
    server_name yourdomain.com www.yourdomain.com;

    root /var/www/html/octobercms;
    index index.php index.html;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
    }
}
The Nginx server block
  • listen 80; listens for HTTP on port 80.
  • server_name is your domain.
  • root points to the October CMS folder.
  • location / serves files, or passes the request to index.php.
  • location ~ \.php$ sends PHP files to PHP-FPM.

Enable the site, test the config and reload:

sudo ln -s /etc/nginx/sites-available/octobercms.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Testing and reloading Nginx
  • ln -s links the file into sites-enabled.
  • nginx -t checks the config for errors.
  • reload applies it.

Step 5: Finish in the browser

Open your domain. The October CMS installer starts. Choose the language.

Selecting the language

Enter the database details (MySQL, host localhost, database octobercms, the user and password from step 2) and the admin account.

The empty database form

When it finishes, log in to the back end and open the dashboard.

The October CMS dashboard

For security, add HTTPS with Certbot and remove the install.php and the installer files if they remain.

Quick recap

  • Install Nginx, MariaDB and PHP, then create a database.
  • Download October CMS, set the owner and make a server block.
  • Complete the web installer.