How to Install Joomla with Nginx on Rocky Linux

Joomla is a free and open-source content management system (CMS) written in PHP. Joomla is one of the most popular CMS after WordPress. Using Joomla you can create astonishing blogs, marketing sites, News websites, eCommerce storefronts, and many dynamic websites in no time. You can use Joomla to host your website without any coding language knowledge. Joomla has lots of free and paid extensions to customize your website as per your requirement.

In this article, You will learn how to install Joomla with Nginx web server on Rocky Linux 8.

Prerequisites

  • A server running Rocky Linux 8.
  • A root password is configured on your server.

Part 1 – Update OS:

First, update your base system by running the following command:

dnf update -y


Part 2 – Install Nginx and MariaDB:


Next, install the Nginx web server by executing the following command:

dnf install nginx


Now, start the Nginx service and enable it at the start at system reboot, then check nginx status using the following command:

systemctl start nginx

systemctl enable nginx

systemctl status nginx


Similarly, install the MariaDB database server using the below command:

dnf install mariadb-server mariadb -y


Now, start MariaDB service, check the service status, and enable it to start at system reboot:

systemctl start mariadb

systemctl enable mariadb

systemctl status mariadb


Part 3 – Install PHP and PHP-FPM


Here, you need to install PHP 7.4 along with PHP-FPM, and other PHP extensions. Rocky Linux 8 has PHP 7.2 by default, So you need to reset PHP version.
Execute the following command to reset your current PHP version and then enable PHP 7.4.

dnf module reset php

dnf module enable php:7.4

Next, install PHP 7.4 and other PHP extensions by executing the below command:

dnf install php php-fpm php-curl php-xml php-zip php-mysqlnd php-intl php-gd php-json php-ldap php-mbstring php-opcache unzip



Now, you need to edit the php.ini file for better performance.

vim /etc/php.ini


Make the following changes in php.ini:

memory_limit = 256M
output_buffering = Off
max_execution_time = 300
upload_max_filesize = 30M
post_max_size = 30M

Save and close the file when you are done.

Now, you need to set the user and group from apache to nginx in PHP-FPM configuration file:

Open PHP-FPM configuration file:

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

Set the value as shown below:

user = nginx
group = nginx
listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nginx
listen.group = nginx
listen.mode =  0660


Save and exit the file and change the permissions of the PHP library directory:

chown -R nginx:nginx /var/lib/php/

Next, start the PHP-FPM service, check the service status and enable it at system reboot using the below command:

systemctl start php-fpm
systemctl status php-fpm
systemctl enable php-fpm

Step 4 – Create the Database for Joomla

You need to create a database and user for Joomla.

First, log into the MariaDB by running the following command:

mysql


Once you are into the MariaDB shell, create a database and user by executing the following commands:

CREATE DATABASE joomladb;
GRANT ALL ON joomladb.* TO 'joomlauser'@'localhost' IDENTIFIED BY 'your_password';

Subsequently, flush the privileges and exit the Database shell:

FLUSH PRIVILEGES;
EXIT;

Step 5 – Download Joomla

Now, go to Official Joomla’s website https://downloads.joomla.org/cms and download the latest Joomla package using the wget command:

At the time of writing this article, Joomla's latest version is Joomla 4.1.0.

Run the below command to download the latest version of Joomla:

wget https://downloads.joomla.org/cms/joomla4/4-1-0/Joomla_4-1-0-Stable-Full_Package.tar.gz?format=gz


Next, create a directory new directory in the webroot directory as shown below:

mkdir -p /var/www/html/joomla


Now, extract the downloaded file content into the joomla directory using the following command:

tar -xvf Joomla_4-1-0-Stable-Full_Package.tar.gz\?format\=gz -C /var/www/html/joomla/

Next, change the ownership and permission of the joomla directory with the following commands:

chown -R nginx:nginx /var/www/html/joomla

chmod -R 755 /var/www/html/joomla


Step 6 – Configure Nginx for Joomla

Create separate Nginx virtual host configuration file for Joomla:

vim /etc/nginx/conf.d/joomla.conf

Now, paste the following lines into joomla.conf file. Kindly replace server_name with your IP address or domain name.

server { 
   listen 80;
   root /var/www/html/joomla;
   index  index.php index.html index.htm;
   server_name  46.101.205.134;
   access_log /var/log/nginx/joomla_access.log;
   error_log /var/log/nginx/joomla_error.log;

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

   location ~ [^/]\.php(/|$) {
   fastcgi_split_path_info  ^(.+\.php)(/.+)$;
   fastcgi_index            index.php;  
   fastcgi_pass             unix:/var/run/php-fpm/php-fpm.sock;
   include                  fastcgi_params;
   fastcgi_param   PATH_INFO       $fastcgi_path_info;
   fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
   }

}

Save and exit the configuration file.

Next, restart nginx service to apply the changes:

systemctl restart nginx


Step 7 – Access Joomla Website


At this stage, Joomla is installed and configured on your server. You can access the Joomla website from your web browser by simply typing http://your_server_ip.

Here, enter details and click on Setup Login Data:

Next, enter the details and click on “Setup Database Connection”

Now, Select Database Type, Enter the hostname,  Database username, and Database Password then click on the Next button. You should see the screenshot like below:

Make sure all the settings are correct, then click on the “Install Joomla” button. It will show you, “Congratulations! Your Joomla site is ready”.

From, Here you can time http://your_ip_or_domain/administrator, It will bring you Joomla's Administrator page as shown in the below screenshot.

Next, enter your Username and Password and you will be redirected to an administrator page:

From here, you can explore many of Joomla's options like users, Install plugins, etc.

Conclusion

Congratulations! You have successfully installed Joomla CMS on Rocky Linux 8. Using wonderful Joomla CMS, you can now build your own website without any programming or coding knowledge. Please don't hesitate to ask if you have any queries.

Share this page:

Suggested articles

0 Comment(s)

Add comment