Skip to content
Follow
CMS Ubuntu Linux

How to Setup Joomla on Ubuntu with Nginx & Cloudflare

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

You can set up Joomla on Ubuntu with Nginx and Cloudflare by configuring each component to work together efficiently.

Joomla is a powerful open-source content management system (CMS) for building websites. Nginx is a high-performance web server known for its speed, and Cloudflare adds a layer of security, DNS management, and content delivery network (CDN) services.

This guide focuses on integrating these tools, likely using Ubuntu Server 22.04 LTS, to create a fast and secure website. You’ll leverage Nginx’s efficient request handling and Cloudflare’s global network to protect and accelerate your Joomla site.

⚡ 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.

Setting up Cloudflare

Setting up Cloudflare is your first step to securing and speeding up your website, especially when using Joomla with Nginx.

Enter your email and click Create Account.

Cloudflare WordPress setup
cloudflare wordpress setup

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

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

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

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

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

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)

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

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

🐧Bash / Shell
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.”

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:

🐧Bash / Shell
sudo apt update
sudo apt install nginx

Use these commands to manage the service:

🐧Bash / Shell
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

Joomla needs a database to keep all your website’s information, so we’ll install MariaDB, a popular database system, on your Ubuntu server.

🐧Bash / Shell
sudo apt-get install mariadb-server mariadb-client

Set the service to run on boot:

🐧Bash / Shell
sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service
🐧Bash / Shell
sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Secure your database:

🐧Bash / Shell
sudo mysql_secure_installation

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

🐧Bash / Shell
sudo mysql -u root -p
mariadb welcome
mariadb ubuntu 1604

Install PHP

Joomla is built using PHP, a programming language that makes websites dynamic, so we need to install it on your Ubuntu system.

🐧Bash / Shell
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
🐧Bash / Shell
sudo apt update
🐧Bash / Shell
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:

🐧Bash / Shell
sudo nano /etc/php/7.2/fpm/php.ini

Update settings and save:

💻Code
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:

🐧Bash / Shell
sudo systemctl restart nginx.service

Create a test file to verify PHP:

🐧Bash / Shell
sudo nano /var/www/html/phpinfo.php
💻Code

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:

🐧Bash / Shell
sudo mysql -u root -p

Create the database and user:

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

Install Joomla

Now it’s time to install Joomla itself, the content management system that will power your website, onto your Ubuntu server.

Command Prompt
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:

🐧Bash / Shell
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:

🐧Bash / Shell
sudo nano /etc/nginx/sites-available/example.com

Add your domain settings and certificate references:

🐘PHP
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:

🐧Bash / Shell
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
🐧Bash / Shell
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?

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.

📚 Related Tutorials

How to Install PowerDNS on Ubuntu Linux
CMS How to Install PowerDNS on Ubuntu Linux
How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04
How to Setup WordPress with Nginx and Cloudflare on Ubuntu
CMS How to Setup WordPress with Nginx and Cloudflare on Ubuntu
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 *