Setup and Install Joomla on Ubuntu, Nginx, MariaDB and PHP

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, avr: 4.00)

Joomla CMS is a free and most popular CMS (Content Management System) which millions user around the world. NGINX is Web server with the latest technology and offers high-performance running and stability with simple platform and configuration.

This tutorial demonstrates step by step how to setup and install Joomla on Ubuntu, Nginx, MariaDB and PHP


Before starting with this guide, make sure that you have root access to your Ubuntu.

Step 1: Installing NGINX as HTTP Server

sudo apt update&&upgrade
sudo apt install nginx

After installing NGINX, the commands below to stop, start and enable Nginx service

Step 2: Enable NGINX and Start or Stop on Server

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

Step 3: Check NGINX status

sudo service nginx status
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2018-05-14 23:03:47 UTC; 16s ago
     Docs: man:nginx(8)
  Process: 13003 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status
  Process: 12994 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exite
 Main PID: 13006 (nginx)
    Tasks: 2 (limit: 1153)
   CGroup: /system.slice/nginx.service
           ├─13006 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           └─13009 nginx: worker process

Step 4: Install Latest MariaDB Server

Setup and Install Joomla require database like MySQL before installing database it’s required the server and to install it run the command below

sudo apt-get install mariadb-server mariadb-client

After Installing MariaDB server it’s recommended to enable service the command below to stop, start and enable

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

Make MariaDB server secure with the command below

sudo mysql_secure_installation

Once installation and prompted just follow answer below:

  • Enter current password for root (enter for none): Just press the Enter
  • Set root password? [Y/n]: Y
  • New password: Your password
  • Re-enter new password: Repeat Your 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

Restart MariaDB Server with the command below

sudo systemctl restart mariadb.service

Step 5: Install PHP-FPM

Let’s install PHP with Latest version package on Ubuntu. Below there are two commands will update the package and get the package to install. Once installation there are questions just pressing Y and ENTER to continue.

sudo apt update && sudo apt install php-fpm

Let’s install PHP Modules package run the command below

sudo apt-get install php7.1-fpm php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-gd php7.1-xml php7.1-intl php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-ldap php7.1-zip php7.1-curl

Configure php.ini

sudo nano /etc/php/7.2/fpm/php.ini
post_max_size = 100M
memory_limit = 256M
max_execution_time = 360
upload_max_filesize = 150M
date.timezone = America/Newyork

Step 6: Create Database for Joomla

Joomla required Database for storing data. To configure Database follow the command below.

sudo mysql -u root -p

Then create a database name ex: “joomla” or anything else that you want. PLEASE attention ‘JOOMLAUSER’ and ‘NEWPASSWORD’ change it whatever you want


Step 7: Download Latest Version Joomla

First we got to to Temporary folder with typing command cd /tmp or just follow the command below

cd /tmp && wget

Then run the commands below to install unzip package, create Joomla folder in Apache2 root folder and extract the Joomla archived file.

sudo apt-get install unzip
sudo mkdir -p /var/www/html/joomla
sudo unzip Joomla*.zip -d /var/www/html/joomla

Grant Directory Permission

sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/

Step 8: NGINX Configuration

Finally, configure Nginx site configuration file for Joomla. This file will control how users access Joomla content. Run the commands below to create a new configuration file called joomla

sudo nano /etc/nginx/sites-available/default

Then copy and paste the content below into the file and save it. Replace the highlighted line with your own domain name and directory root location.

server {
    listen 80;
    listen [::]:80;
    root /var/www/html/joomla;
    index  index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$args;        

    location ~ \.php$ {
         include snippets/fastcgi-php.conf;
         fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;


Cmd/Ctr X and Y to save and exit

Step 9: Enable NGINX Server Block

Nginx has a default server block in which we can use as our server blocks.

sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default

Step 10: Restart Nginx And PHP

sudo systemctl restart nginx.service
sudo systemctl restart php7.1-fpm.service

Now got to the browser and acces your IP addres or localhost (local server)

Recommended For You

About the Author: Axfod is a site Online publisher for collection of guides and tutorials about Internet Technology