Websites & apps

Install Joomla 5 on a Linux VPS with Nginx

Install Joomla 5 on an Ubuntu or AlmaLinux VPS with Nginx, PHP-FPM and MariaDB, including the PHP extensions, an Nginx config with SEF URLs, SSL and post-install hardening.

IntermediateLinux VPS2 min read

Joomla is a flexible open-source CMS. Running it on a VPS gives you full control over PHP and caching. This guide installs Joomla 5 on a Linux VPS with Nginx, PHP-FPM and MariaDB.

Before you start

Install PHP extensions

Joomla 5 needs PHP 8.1 or newer:

sudo apt install php8.3-fpm php8.3-mysql php8.3-xml php8.3-zip php8.3-gd php8.3-intl php8.3-mbstring php8.3-curl unzip

Create the database

sudo mysql -e "CREATE DATABASE joomla CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'joomla'@'localhost' IDENTIFIED BY 'StrongPasswordHere'; GRANT ALL ON joomla.* TO 'joomla'@'localhost'; FLUSH PRIVILEGES;"

Download Joomla

Download the full package zip from the official Joomla downloads page, then extract it:

sudo mkdir -p /var/www/joomla && sudo unzip /tmp/Joomla_5*-Stable-Full_Package.zip -d /var/www/joomla && sudo chown -R www-data:www-data /var/www/joomla

Configure Nginx

server {
    listen 80;
    server_name example.com www.example.com;
    root /var/www/joomla;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    location ~* /(administrator/(cache|logs)|cache|logs|tmp)/ {
        deny all;
    }
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    }
}

Enable the site, run sudo nginx -t, reload Nginx and add SSL with Certbot.

Run the installer

  1. Open https://example.com.
  2. Set the site name and admin login.
  3. Choose MySQLi, host localhost, and the database user and name from above. Keep a random table prefix.
  4. Finish. Joomla 5 removes the installation folder for you; if it remains, delete it.

After installing

  • In System → Global Configuration → Site, enable Search Engine Friendly URLs and Use URL Rewriting. The Nginx try_files rule makes them work.
  • Under Server, set Force HTTPS to Entire Site.
  • Turn on two-factor authentication for admin accounts.
  • Apply Joomla updates promptly from System → Update.

Troubleshooting

  • 404 with URL rewriting on: the try_files line is missing.
  • Extension upload fails: raise upload_max_filesize and Nginx client_max_body_size.
  • Error 0 or blank page: set Error Reporting to Maximum temporarily and read the PHP-FPM log, or see debug a PHP white screen.

FAQ

Does Joomla need .htaccess on Nginx?

No. Nginx ignores .htaccess; the try_files rule does the same job. On Apache or LiteSpeed, rename htaccess.txt to .htaccess.

Which PHP version is best for Joomla 5?

PHP 8.2 or 8.3. Both are supported and faster than 8.1.

Can I upgrade from Joomla 4 to 5 on the VPS?

Yes, with the built-in updater, once your extensions are compatible. Back up the files and database first.

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.