Joomla is an open-source and PHP-based content management system used for creating different types of websites including blogs, eCommerce storefronts, and marketing sites. It is simple, user-friendly, and provides an easy way to build dynamic and powerful websites. You can use Joomla to host your website on the Internet easily without the need to learn how to read and write complicated codes and scripts.
In this post, we will show you how to install Joomla with Nginx on Rocky Linux 8.
Step 1 – Install Nginx and MariaDB
First, install the Nginx and MariaDB database servers with the following command:
dnf install nginx mariadb-server -y
Once both packages are installed, start the Nginx and MariaDB services and enable them to start at system reboot:
systemctl start nginx mariadb systemctl enable nginx mariadb
Step 2 – Install PHP and PHP-FPM
Next, you will need to install PHP 7.4, PHP-FPM, and other PHP extensions on your server.
The default PHP version is set to PHP 7.2 in Rocky Linux 8. In order to install the latest PHP 7.4, you will need to reset the default PHP steams.
Run the following command to reset the default PHP:
dnf module reset php
Next, enable the PHP 7.4 version using the following command:
dnf module enable php:7.4
Next, install PHP 7.4 with other extensions using the following 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 -y
Once all the packages are installed, edit the php.ini file and tweak some settings:
nano /etc/php.ini
Change the following values:
memory_limit = 256M output_buffering = Off max_execution_time = 300 date.timezone = Europe/London
Save and close the file when you are done.
Next, edit the PHP-FPM configuration file:
nano /etc/php-fpm.d/www.conf
Change the user and group from apache to nginx:
user = nginx group = nginx
Save and close the file, then set proper permissions to the PHP library directory:
chown -R nginx:nginx /var/lib/php/
Next, start the PHP-FPM service and enable it to start at system reboot:
systemctl start php-fpm systemctl enable php-fpm
Step 3 – Create a Joomla Database
Joomla uses MySQL/MariaDB as a database backend, so you will need to create a database and user for Joomla.
First, log in to the MariaDB shell with the following command:
mysql
Once you are connected, create a database and user with the following command:
CREATE DATABASE joomladb; GRANT ALL PRIVILEGES ON joomladb.* TO 'joomla'@'localhost' IDENTIFIED BY 'password';
Next, flush the privileges and exit from the MariaDB shell with the following command:
FLUSH PRIVILEGES; EXIT;
Step 4 – Download Joomla
Next, go to the Joomla download and download the latest version of Joomla using the following command:
wget https://downloads.joomla.org/cms/joomla3/3-9-28/Joomla_3-9-28-Stable-Full_Package.zip
Next, create a directory for Joomla and extract the downloaded file inside the joomla directory:
mkdir -p /var/www/html/joomla unzip Joomla*.zip -d /var/www/html/joomla
Next, set proper permissions and ownership to the joomla directory:
chown -R nginx:nginx /var/www/html/joomla chmod -R 755 /var/www/html/joomla
Step 5 – Configure Nginx for Joomla
Next, you will need to create an Nginx virtual host configuration file for Joomla. You can create it with the following command:
nano /etc/nginx/conf.d/joomla.conf
Add the following lines:
server { listen 80; root /var/www/html/joomla; index index.php index.html index.htm; server_name joomla.example.com; location / { try_files $uri $uri/ /index.php?$args; } location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_index index.php; fastcgi_pass unix:/run/php-fpm/www.sock; include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }
Save and close the file, then restart the Nginx service to apply the changes:
systemctl restart nginx
Step 6 – Access Joomla Website
Now, Joomla is installed and configured on your server. You can now access the Joomla website using the URL http://joomla.example.com. You should see the following screen:
Select your language, provide your site information, define your admin user and password, then click on the Next button. You should see the database configuration page:
Provide your database information and click on the Next button. You should see the overview page:
Make sure all the settings are correct, then click on the Install button. Once the installation has been completed, you should see the following page:
Now, remove the installation folder using the following command:
rm -rf /var/www/html/joomla/installation
Next, click on the Administrator button. You should see the Joomla login page:
Provide your admin username and password, then click on the Login button. You should see the following page:
Conclusion
In this guide, we explained how to install Joomla with Nginx on Rocky Linux 8. You can now use your dedicated server hosting account to start creating your blog or website using Joomla.