Close
    logoMevspace Docs
    English

    How to install Joomla on a dedicated server with NGINX?

    Reading time: 4 min

    Tutorial for the Ubuntu 20.04 distribution.

    1

    To begin, you must connect to your server using the SSH protocol.

    shh root@ip_address

    After logging in, you have to make sure that our server has up-to-date software. We check this with the following command:

    apt-get update
    apt-get upgrade
    2

    Install Nginx server.

    Joomla requires a webserver to operate. For this we will use Nginx, which is one of the most popular webservers. We install it using this command:

    apt install nginx

    To verify that the server has installed and is functioning correctly we enter:

    systemctl status nginx

    If everything is working properly we should get this result:

    how to install joomla on dedicated server nginx 1

    3

    Installing PHP version 8.2 and the necessary patches.

    Caution: We are installing php version 8.2, which is not supported by ubuntu 20.04 by default, so we need to add this package from the official php repository:

    apt install software-properties-common
    add-apt-repository ppa:ondrej/php

    Add a repository, select option number 3 and confirm by clicking ENTER.

    how to install joomla on dedicated server nginx 2

    Now we have to install PHP and the necessary packages. We will use the command:

    apt install php8.2 php8.2-common php8.2-cli php8.2-fpm php8.2-mysql php8.2-opcache php8.2-gmp php8.2-curl php8.2-intl php8.2-mbstring php8.2-xmlrpc php8.2-gd php8.2-xml php8.2-zip

    To verify that the installation has performed correctly we enter:

    php -v

    Correct installation should give us the following result:

    Then, in order to optimize Joomla's performance, some changes need to be made to the configuration file /etc/php/8.2/fpm/php.ini.

    We find the following items in it and change the standard values as required. These can be the values presented below:

    memory_limit = 512M
    upload_max_filesize = 256M
    post_max_size = 256M
    max_execution_time = 300
    output_buffering = off
    date.timezone = Europe/Warsaw

    Save the file, and restart PHP, we can use the command for this:

    systemctl restart php*
    4

    Installation of the MariaDB database.

    Joomla requires a database in order to function. We will use MariaDB server for this by installing it with the following command:

    apt install mariadb-server mariadb-client

    Then, to complete the database installation we type:

    mysql_secure_installation

    Among other things, this script sets the password to the root user, disables remote logins to it or deletes anonymous users. Each time, we type "Y" for the previously mentioned tasks to take place.

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

    Create a database for Joomla.

    When installing Joomla, a database will be required. So we should create a database as well as a user before installation. First we need to connect to the database:

    mysql –u root -p

    We then create the base and user with the following commands:

    MariaDB [(none)]> CREATE DATABASE joomla;
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON joomla.* TO 'joomla'@'localhost'
    IDENTIFIED BY ‘TwojeHaslo';
    MariaDB [(none)]> FLUSH PRIVILEGES;
    MariaDB [(none)]> EXIT;

    In this way, we have a database prepared for Joomla.

    6

    Start Joomla installation.

    We already have the environment prepared, so we can start installing Joomla. We download the latest available version (at the moment it is Joomla 4.3.4.) We download it using the command:

    wget https://downloads.joomla.org/cms/joomla4/4-3-4/Joomla_4-3-4-Stable-Full_Package.zip?format=zip

    After downloading the package, we extract the archive to the /var/www/html/joomla catalog. We use the command:

    sudo unzip Joomla_4-3-4-Stable-Full_Package.zip?format=zip -d /var/www/html/joomla

    At the very end, we change the user for the /var/www/html/joomla directory to the user www-data:

    chown -R www-data:www-data /var/www/html/joomla/
    7

    NGINX configuration for Joomla.

    One of the last steps is to create a virtual host file for the Joomla installation. We need to create the following file:

    nano /etc/nginx/sites-available/joomla.conf

    Add the following lines:

    server {
    listen 80 default_server;
    listen [::]:80 default_server;
    root /var/www/html/joomla;
    index index.php index.html index.htm;
    server_name TWOJADOMENA.pl WWW.TWOJADOMENA.pl;
    location / {
    try_files $uri $uri/ =404;
    }
    location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    }
    }

    You can test this file with the command to be sure the syntax is correct:

    nginx -t

    If the configuration is correct you should see a notification like this:

    how to install joomla on dedicated server nginx 4

    To activate our site, we create a symbolic link to the file we created earlier using the command:

    ln -s /etc/nginx/sites-available/joomla.conf /etc/nginx/sites-enabled/

    Finally, let's reset the Nginx server so that the saved changes will update:

    systemctl restart nginx

    We can now proceed to configure our Joomla. Type your domain name in the format "http://yourdomain.com" into your browser and begin the configuration process. We choose the language and the name of our site.

    how to install joomla on dedicated server nginx 5

    We then create the login details for the administrator account.

    how to install joomla on dedicated server nginx 6

    We now complete the database configuration as we created in the previous steps.

    how to install joomla on dedicated server nginx 7

    Once all the details have been entered, we can confirm the Joomla installation. After installation, it remains for us to click on the Open Site button to see our main homepage.

    Congratulations! The installation of Joomla is now complete and you can use and modify it according to your needs.

    Previous
    How to configure additional IPv4 addresses for dedicated servers?
    Next
    How to install Proxmox virtualization via KVM?