Skip to content
Follow
CMS Ubuntu Linux

How to Setup Joomla on Ubuntu with Nginx & Cloudflare

Richard
Written by
Richard
Apr 24, 2019 Updated Sep 15, 2026 5 min read
How to Change Default Apps in Ubuntu
How to Change Default Apps in Ubuntu

Setting up Joomla on Ubuntu Server 22.04 LTS with Nginx and Cloudflare connects a popular website builder to a fast web server and a security shield. Joomla is a free system for building websites, Nginx is software that loads web pages quickly, and Cloudflare protects your site from attacks while speeding it up for visitors.

Advertisement

Pairing Nginx with Cloudflare gives your Joomla site strong security and quick load times. Follow the steps below to get everything working together properly.

  1. Sign up for a Cloudflare account and add your website.
  2. Update your domain’s nameservers at your registrar to Cloudflare’s.
  3. In Cloudflare, set SSL/TLS to “Full (Strict)” and create an Origin Certificate.
  4. Turn on “Always Use HTTPS” and “Automatic HTTPS Rewrites” in Cloudflare.
  5. Install Nginx, MariaDB, and PHP on your Ubuntu server.
  6. Create a database and user for Joomla in MariaDB.
  7. Download and install Joomla into your web server’s directory.
  8. Configure Nginx to serve your Joomla site, including SSL settings.
  9. Visit your domain in a browser to complete the Joomla setup wizard.
  10. Remove the Joomla installation folder from your server.
⚡ Quick Answer

To set up Joomla on Ubuntu with Nginx and Cloudflare, first configure Cloudflare DNS and SSL settings. Then, install Nginx, MariaDB, and PHP on your Ubuntu server. Finally, install Joomla and configure Nginx to serve your Joomla site.

Advertisement

Setting up Cloudflare

Setting up Cloudflare for your Joomla Nginx server protects your website from attacks and speeds up page loading times for visitors. You can configure this by creating an account at dash.cloudflare.com, adding your domain name, and updating your DNS settings to route your traffic through the Cloudflare network.

Enter your email and click Create Account.

Cloudflare WordPress setup
cloudflare wordpress setup

Once logged in, click the “Add a Site” button.

Advertisement
Cloudflare WordPress setup
cloudflare wordpress setup 1

Type in your domain name. registered

Cloudflare WordPress setup
cloudflare wordpress setup 2

Cloudflare will scan your domain for existing records.

Cloudflare WordPress setup
cloudflare wordpress setup 3

Select the free plan.

Cloudflare WordPress setup
cloudflare wordpress setup 4
⚠️WarningCloudflare will give you two nameservers.

Log in to your domain registrar (where you bought your domain) and replace your current nameservers with these two.

Advertisement
This image has an empty alt attribute; its file name is cloudflare-setup-name-servers.png
cloudflare setup name servers

Example: If your domain is at Google Domains, select "use custom nameservers" and save the new addresses.

Cloudflare WordPress Setup
cloudflare wordpress setup 16

It can take up to an hour for these changes to take effect. Check your Cloudflare dashboard until the status says "Active."

This image has an empty alt attribute; its file name is cloudflare-overview-active.png
cloudflare overview active

Your DNS entries should now appear in the Cloudflare dashboard.

Cloudflare WordPress Setup
cloudflare wordpress setup 6
⚠️WarningGo to the SSL/TLS tab and set it to "Full (Strict)."

Go to the SSL/TLS tab and set it to "Full (Strict)."

Advertisement
Cloudflare WordPress Setup
cloudflare wordpress setup 17

Scroll down to "Origin Certificates" and click "Create Certificate."

This image has an empty alt attribute; its file name is cloudflare_wordpress_setup_8.png
cloudflare wordpress setup 8

Let Cloudflare generate the key and click Next.

WordPress Cloudflare
cloudflare wordpress setup 9

You will need to create three files on your server using these commands. (Requires admin privileges)

sudo nano /etc/ssl/private/cloudflare_key_example.com.pem
sudo nano /etc/ssl/certs/cloudflare_example.com.pem

Download the Cloudflare Origin Pull certificate here: Set up authenticated Origin pulls · Cloudflare SSL docs

Advertisement
sudo nano /etc/ssl/certs/origin-pull-ca.pem

You now have three files: cloudflare_key_example.com.pem, cloudflare_example.com.pem, and origin-pull-ca.pem.

This image has an empty alt attribute; its file name is cloudflare_wordpress_setup_10.png
cloudflare wordpress setup 10

In the Cloudflare dashboard, turn on "Always Use HTTPS."

This image has an empty alt attribute; its file name is cloudflare_wordpress_setup_11.png
cloudflare wordpress setup 11

Turn on "Authenticated Origin Pulls" and "Opportunistic Encryption."

This image has an empty alt attribute; its file name is cloudflare_wordpress_setup_12.png
cloudflare wordpress setup 12

Turn on "Automatic HTTPS Rewrites."

Advertisement
This image has an empty alt attribute; its file name is cloudflare_wordpress_setup_13.png
cloudflare wordpress setup 13

Go to "Page Rules" and create a rule to always use HTTPS for your domain.

This image has an empty alt attribute; its file name is cloudflare_wordpress_setup_15.png
cloudflare wordpress setup 15

Install and Configure Joomla

Log in to your server. (Requires admin privileges)

Install Nginx:

sudo apt update
sudo apt install nginx

Use these commands to manage the service:

Advertisement
sudo systemctl stop nginx.service
sudo systemctl start nginx.service
sudo systemctl enable nginx.service

Test your server by visiting your site address in a browser.

nginx default home page test
nginx default page

Install MariaDB Database

Installing MariaDB on your Ubuntu server gives Joomla a reliable database system to store all your website data and user information. You can complete this setup by running the package installation command in your terminal and making sure the database service runs automatically when your server starts.

sudo apt-get install mariadb-server mariadb-client

Set the service to run on boot:

sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service
sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Secure your database:

sudo mysql_secure_installation

Follow the on-screen prompts to set a password and remove test settings.

sudo mysql -u root -p
mariadb welcome
mariadb ubuntu 1604

Install PHP

Installing PHP on your Ubuntu system allows your server to process the code that runs your Joomla website. You need to add the required software repository, update your package list, and install the specific PHP packages that work with your web server setup.

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.2-fpm php7.2-common php7.2-gmp php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-mysql php7.2-gd php7.2-xml php7.2-cli php7.2-zip

Edit the configuration file:

sudo nano /etc/php/7.2/fpm/php.ini

Update settings and save:

file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 256M
cgi.fix_pathinfo = 0
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago

Restart Nginx:

sudo systemctl restart nginx.service

Create a test file to verify PHP:

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

Visit your site address followed by /phpinfo.php to see the test page.

PHP Test Page
php test page

Create Joomla Database

Log in to the database:

sudo mysql -u root -p

Create the database and user:

CREATE DATABASE joomla;
CREATE USER 'joomlauser'@'localhost' IDENTIFIED BY 'new_password_here';
GRANT ALL ON joomla.* TO 'joomlauser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

Install Joomla

Installing Joomla on your Ubuntu server lets you build and manage your website content using the popular content management system. You can set this up by downloading the official installation package from the Joomla website and extracting those files directly into your web server directory.

cd /tmp
wget https://downloads.joomla.org/cms/joomla3/3-9-5/joomla_3-9-5-stable-full_package-zip
sudo unzip -d /var/www/html/example.com /tmp/joomla_3-9-5-stable-full_package-zip

Set permissions:

sudo chown -R www-data:www-data /var/www/html/example.com/
sudo chmod -R 755 /var/www/html/example.com/

Configure Nginx for your site:

sudo nano /etc/nginx/sites-available/example.com

Add your domain settings and certificate references:

server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;

server_name example.com www.example.com;
root /var/www/html/example.com;
index index.php;

ssl_certificate /etc/ssl/certs/cloudflare_example.com.pem;
ssl_certificate_key /etc/ssl/private/cloudflare_key_example.com.pem;
ssl_client_certificate /etc/ssl/certs/origin-pull-ca.pem;
ssl_verify_client on;

client_max_body_size 100M;

autoindex off;

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

location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

Enable the site:

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo systemctl restart nginx.service

Visit your domain in a browser to finish the setup wizard.

Joomla installation on Ubuntu
joomla ubuntu installation

Enter your database info:

Joomla installation on Ubuntu
joomla ubuntu installation 1

Confirm settings and install:

Joomla installation on Ubuntu
joomla ubuntu installation 2

Remove the installation folder:

Joomla installation on Ubuntu
joomla ubuntu installation 3

Log in to your dashboard:

Joomla installation on Ubuntu
joomla ubuntu installation 4
Joomla Ubuntu install
joomla ubuntu installation 5
sudo rm -rf /var/www/html/joomla/installation

Summary

You have successfully installed Joomla on an Ubuntu server protected by Nginx and Cloudflare. You configured a database, added SSL encryption for security, and set up a custom domain. Your site is now ready for content.

[Y/n]

[Y/n]

[Y/n]

[Y/n]

[Y/n]









Was this guide helpful?

Tags: #Cloudflare #Joomla #Ubuntu Linux
Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

3169 articles → Twitter
Advertisement

📚 Related Tutorials

How to Install Joomla with Apache & Cloudflare on Ubuntu
CMS How to Install Joomla with Apache & Cloudflare on Ubuntu
How to Install Joomla with Lighttpd on Ubuntu 24.04
CMS How to Install Joomla with Lighttpd on Ubuntu 24.04
How to Setup WordPress Nginx Cloudflare Ubuntu Fast
CMS How to Setup WordPress Nginx Cloudflare Ubuntu Fast
How to Install Drupal with Nginx and Cloudflare on Ubuntu
CMS How to Install Drupal with Nginx and Cloudflare on Ubuntu

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *