Skip to content
Follow
CMS

How to install MODX CMS with Nginx on Ubuntu 24.04

Richard
Written by
Richard
Jun 14, 2024 Updated Jul 11, 2026 7 min read
MODX featured image
MODX featured image

You install MODX CMS with Nginx on Ubuntu 24.04 to set up a powerful, flexible website managed by a fast, efficient web server.

MODX is an open-source content management system great for building dynamic websites, while Nginx is a lightweight web server celebrated for its performance.

This tutorial guides you through combining MODX's user-friendly CMS capabilities with Nginx's speed on Ubuntu 24.04, a popular Linux operating system released in April 2024.

A robust and high-performing hosting environment for your website is created by following these steps, which include installing Nginx version 1.26.1 and configuring MODX CMS for optimal performance on Ubuntu 24.04.

⚡ Quick Answer

Install Nginx using `sudo apt install nginx`, then install MariaDB with `sudo apt install mariadb-server`. Configure PHP-FPM and create a MODX database and user. Finally, download and extract MODX files to your web server’s document root.

Install Nginx HTTP server on Ubuntu

You can install the Nginx web server on Ubuntu by opening your terminal and running a couple of commands. Nginx is a web server that will handle your website’s traffic and is needed to set up MODX.

To do that, open the Ubuntu terminal and run the commands below to install the Nginx web server.

🐧Bash / Shell
sudo apt update
sudo apt install nginx

Once Nginx is installed, the commands below can start, stop, and enable the Nginx web server to start automatically when your server boots up.

🐧Bash / Shell
sudo systemctl stop nginx
sudo systemctl start nginx
sudo systemctl enable nginx

You can test the Nginx web server by opening your web browser and browsing to the server’s localhost or IP address.

http://localhost

Nginx default welcome page on Ubuntu 24.04
Nginx default welcome page on Ubuntu 24.04

When you see the “Welcome to nginx!” page, it means the Nginx HTTP server is successfully installed.

Additional help on installing Nginx on Ubuntu is in the link below.

How to install Nginx on Ubuntu

Install the MariaDB database server on Ubuntu

MODX needs a place to store all its information, and MariaDB is a great choice for this. You can install the MariaDB database server on Ubuntu using simple commands in your terminal.

To install and use the MariaDB database server, use the instructions below.

Open the Ubuntu terminal and run the commands below to install the MariaDB database server.

🐧Bash / Shell
sudo apt update
sudo apt install mariadb-server

Once the MariaDB database server is installed, use the commands below to stop, start, and enable the MariaDB server to start automatically when the server boots.

🐧Bash / Shell
sudo systemctl stop mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb

Run the following commands to validate and test if the MariaDB database server is installed successfully.

🐧Bash / Shell
sudo mariadb

Once you run the commands above, it will log you onto the MariaDB console and display a message similar to the one below.

💻Code
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 32
Server version: 10.11.2-MariaDB-1 Ubuntu 23.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]> 

The message tells you that the server is installed successfully.

Additional help on installing MariaDB.

Create a MODX database

After setting up MariaDB, you need to make a new, special database just for your MODX website. This database will hold all your website’s content and settings, and we’ll set up a specific name and password for it.

As part of the setup, we will create a modxdb database and a user account called modxdbuser.

Finally, we’ll grant the modxdbuser full access to the modxdb database.

All the database steps above can be done using the commands below:

But first, log on to the MariaDB database server:

🐧Bash / Shell
sudo mariadb

Then run the commands below to complete the steps:

💻Code
CREATE DATABASE modxdb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER modxdbuser@localhost IDENTIFIED BY 'type_your_password_here';
GRANT ALL ON modxdb.* TO modxdbuser@localhost WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit

Ensure to replace ‘type_your_password_here ‘with your password.

Install PHP-FPM on Ubuntu Linux

MODX needs PHP-FPM to work properly on your Ubuntu Linux system. You can install PHP-FPM, along with other important pieces like php-mysql and php-curl, using just one command in your terminal.

Run the commands below to install PHP-FPM.

🐧Bash / Shell
sudo apt install php-fpm php-intl php-mysql php-curl php-cli php-zip php-xml php-gd php-common php-mbstring php-xmlrpc php-json php-sqlite3 php-soap php-ldap php-zip

Additional help on installing PHP-FPM

How to install PHP on Ubuntu Linux

Download MODX files

To get MODX ready, you need to download the latest version of its files from the official MODX website. After downloading, you’ll put these files into a special folder that your Nginx web server is set up to look at.

To always install the latest version, check the MODX’s download page. If a new version is available, replace the version number in the link below.

⚠️Warning
First, navigate to the /tmp/ directory and download MODX files. After unzipping the file, move the content into the MODX folder in the Nginx root directory.
⚠️Warning
The final step is to change the permissions. This will allow the Nginx web server to interact safely with the files, ensuring a secure environment for your MODX installation.
Command Prompt
cd /tmp
wget https://modx.s3.amazonaws.com/releases/3.0.5/modx-3.0.5-pl.zip
unzip modx-*.zip
sudo mv modx-*/ /var/www/modx
sudo chown -R www-data:www-data /var/www/modx

Once you have completed all the above steps, continue configuring the Nginx web server below to serve the MODX content.

Run the commands below to create a Nginx virtual host file for MODX.

🐧Bash / Shell
sudo nano /etc/nginx/sites-available/modx.conf

Then, copy and paste the content block below into the Nginx server block.

🐘PHP
server {
listen 80;
listen [::]:80;
server_name modx.example.com;
root /var/www/modx;
index index.php;
client_max_body_size 30M;

# the MODX part
location @modx-rewrite {
rewrite ^/(.*)$ /index.php?q=$1&$args last;
}

location / {
absolute_redirect off;
try_files $uri $uri/ @modx-rewrite;
}

location ~ ^/(.(?!well_known)|_build|_gitify|_backup|core|config.core.php) {
rewrite ^/(.(?!well_known)|_build|_gitify|_backup|core|config.core.php) /index.php?q=doesnotexist;
}

location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort on;
fastcgi_param SERVER_NAME $http_host;
}

location ~ /.ht {
deny all;
}
}

Save the file.

You can enable the virtual host for your MODX CMS site by running the command `sudo a2ensite modx.conf` and then restart the Nginx server with `sudo systemctl restart nginx` to apply these changes.

🐧Bash / Shell
sudo ln -s /etc/nginx/sites-available/modx.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx.service

Setup Let’s Encrypt SSL/TLS for MODX

It’s very important to secure your MODX website with HTTPS to protect your visitors’ information. Let’s Encrypt provides a free way to add this security to your MODX site on Ubuntu when using Nginx.

Please read the post below for additional resources on installing and creating Let’s Encrypt SSL certificates for Nginx.

How to set up Let’s Encrypt SSL certificate for Nginx on Ubuntu Linux

Once you have restarted the Nginx web server, open your browser and browse to the server hostname or IP address defined in the Nginx server block.

💻Code
http://modx.example.com/setup

A MODX installation wizard page should appear. Select the installation language and click Continue.

MODX installation wizard language
MODX installation wizard language

Then, select MODX installation type. For this post, we’re choosing “New Installation.”

MODX installation type
MODX installation type

Next, enter the database name, account, and password and click Test. Create an admin account on the same page and continue.

MODX installation wizard database connection setup
MODX installation wizard database connection setup

Next, click the Install button to begin the installation.

MODX installation wizard progress screen
MODX installation wizard progress screen

On the next screen, ensure all the tests are successful and click Continue.

MODX installation test completion on Ubuntu
MODX installation test completion on Ubuntu

Your MODX site should be set up and ready to use.

MODX installation installation complete
MODX installation installation complete

That should do it!

Conclusion

  • In conclusion, this article has provided a comprehensive guide for installing MODX CMS with Nginx support on Ubuntu 24.04, a robust platform for website development.
  • Following the step-by-step instructions, users can successfully set up Nginx, MariaDB, PHP-FPM, and Let’s Encrypt SSL/TLS for MODX.
  • Leveraging the benefits of MODX CMS and Nginx web server, users can create and manage websites efficiently and securely on Ubuntu 24.04.
  • The seamless integration of MODX with Nginx, MariaDB, and PHP-FPM ensures a reliable and high-performance website hosting and management environment.
  • The addition of the Let’s Encrypt SSL/TLS certificate provides an extra layer of security, ensuring the safety of the MODX site and its users.

Is modx a good CMS?

The MODX content management system (CMS) is our holy grail for building websites, web shops, intranets and other digital products. This CMS is a bit more unknown than CMSs like WordPress, Joomla and Drupal, but its online performance certainly doesn't fall short of that.

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 FossBilling with Nginx on Ubuntu Linux
CMS How to Install FossBilling with Nginx on Ubuntu Linux
How to Install FreeScout with Nginx on Ubuntu Linux
CMS How to Install FreeScout with Nginx on Ubuntu Linux
How to Install Monica CRM on Ubuntu with Nginx
CMS How to Install Monica CRM on Ubuntu with Nginx
How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04

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

Leave a Comment

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