This guide explains how to prepare a clean Ubuntu installation for Joomla! by installing Nginx, MariaDB, and PHP 8.5. It also includes VMware shared folder access, database import, PHP configuration, and the initial Joomla! directory setup.


Access VMware Shared Folders (Windows 11 Host)

If you are testing Ubuntu in VMware Workstation and your host operating system is Windows 11, mount the shared folders first.

sudo mkdir -p /mnt/hgfs
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other

Update Ubuntu

Always start by updating the operating system.

sudo apt update
sudo apt upgrade -y
sudo reboot

Install Nginx

Install the Nginx web server.

sudo apt install nginx -y

Reboot the server after installation.

sudo reboot

Verify that Nginx is Running

sudo systemctl status nginx

You should see output similar to:

● nginx.service - A high performance web server and reverse proxy server
     Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled)
     Active: active (running)

Check the Default Document Root

sudo nginx -T | grep root

Expected output:

root /var/www/html;

Install MariaDB

Update the package list once more.

sudo apt update
sudo apt upgrade -y
sudo reboot

Install MariaDB server and client.

sudo apt install mariadb-server mariadb-client -y

Reboot after installation.

sudo reboot

Verify Installation

mariadb --version
sudo systemctl status mariadb

You should see something similar to:

mariadb  Ver 15.1 Distrib 11.x.x

● mariadb.service - MariaDB Database Server
     Active: active (running)

Secure MariaDB Installation

Run the MariaDB security script.

sudo mariadb-secure-installation

Recommended answers:

QuestionRecommended Answer
Enter current password for root (enter for none)Enter current password
Switch to unix_socket authentication?Y
Change the root password?N
Remove anonymous users?Y
Disallow root login remotely?Y
Remove test database?Y
Reload privilege tables now?Y

Create the Joomla! Database

Open the MariaDB console.

sudo mariadb

Create a new database.

CREATE DATABASE joomla
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;

Import an Existing Joomla! Database

If you already have a Joomla! database backup, import it using:

sudo mariadb joomla < joomla.sql

Import an Existing Joomla! Database with create database

mariadb -u root -p < mydatabase.sql

Install PHP 8.5

Install the required repository packages.

sudo apt install -y software-properties-common ca-certificates curl

sudo add-apt-repository ppa:ondrej/php -y
sudo apt update

Install PHP 8.5 together with the extensions commonly required by Joomla!.

sudo apt install -y \
    php8.5 \
    php8.5-cli \
    php8.5-fpm \
    php8.5-common \
    php8.5-mysql \
    php8.5-curl \
    php8.5-gd \
    php8.5-mbstring \
    php8.5-xml \
    php8.5-zip \
    php8.5-intl \
    php8.5-bcmath

Reboot the server.

sudo reboot

Verify PHP Installation

php -v
sudo systemctl status php8.5-fpm

Expected output:

PHP 8.5.x

● php8.5-fpm.service
     Active: active (running)

Configure Nginx to Process PHP Files

Open the default Nginx site configuration.

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

Locate the following commented block:

# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
and add index.php to the list. The following:
location / {
	# First attempt to serve request as file, then
	# as directory, then fall back to displaying a 404.
	try_files $uri $uri/ =404;
}
change to:
location / {
	# First attempt to serve request as file, then
	# as directory, then fall back to displaying a 404.
	try_files $uri $uri/ /index.php?$args;
}
Following:
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
#       include snippets/fastcgi-php.conf;
#
#       # With php-fpm (or other unix sockets):
#       fastcgi_pass unix:/run/php/php7.4-fpm.sock;
#       # With php-cgi (or other tcp sockets):
#       fastcgi_pass 127.0.0.1:9000;
#}

Replace it with:

# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
    include snippets/fastcgi-php.conf;

    # With php-fpm
    fastcgi_pass unix:/run/php/php8.5-fpm.sock;
}
Since opening articles didnt work, I was receiving 404, at the end my configuration looks like:
location / {
    try_files $uri $uri/ =404;
}

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

location ~ \.php(?:/|$) {
    include snippets/fastcgi-php.conf;

    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    fastcgi_pass unix:/run/php/php8.5-fpm.sock;
}

Save the file (Ctrl+S) and exit Nano (Ctrl+X).

Verify the Nginx Configuration

sudo nginx -t

Expected output:

nginx: configuration file /etc/nginx/nginx.conf test is successful

Restart Nginx

sudo systemctl restart nginx

Create a PHP Test Page

Create a simple phpinfo() page.

sudo nano /var/www/html/info.php

Add the following content:

<?php
phpinfo();

Save the file (Ctrl+S) and exit Nano (Ctrl+X).

Open your browser and navigate to:

http://127.0.0.1/info.php

If PHP is configured correctly, the PHP information page will be displayed.


Prepare the Joomla! Directory

After copying your existing Joomla! files, create the destination folder if necessary and assign ownership to your current user.

sudo mkdir -p /var/www/html/joomla
sudo chown $USER:$USER /var/www/html/joomla

You can now copy your Joomla! files into /var/www/html/joomla and continue with the Joomla! configuration.

Add user to MariaDb and grant permissions:
sudo mariadb
CREATE USER 'joomla'@'localhost' IDENTIFIED BY 'myPass';
GRANT ALL PRIVILEGES ON joomla.* TO 'joomla'@'localhost';
FLUSH PRIVILEGES;
Test:
mariadb -u joomla -p
If it logs in successfully, run:
USE joomla;
SHOW TABLES;
Update configuration.php
sudo nano /var/www/html/joomla/configuration.php
Change these lines:
public $user = 'joomla';
public $password = 'MyStrongPassword123!';
public $db = 'joomla';

Next Steps

  • Copy your Joomla! files into /var/www/html/joomla.
  • Adjust ownership and permissions if necessary.
  • Update configuration.php with your database settings.
  • Open your Joomla! website in the browser and verify everything is working correctly.