This article explains how to install MODX CMS with Nginx support on Ubuntu 24.04.
MODX is a flexible and powerful content management system (CMS) allowing you to easily build and manage websites. Nginx, on the other hand, is a high-performance web server that can help improve the speed and reliability of your website.
By installing MODX CMS with Nginx on Ubuntu, you can take advantage of the benefits of both MODX and Nginx, creating a robust and efficient platform for your website.
The steps below walk you through installing MODX CMS with Nginx on Ubuntu 24.04.
Install Nginx HTTP server on Ubuntu
MODX requires a web server. This post will install and use the Nginx web server to run MODX.
To do that, open the Ubuntu terminal and run the commands below to install the Nginx web server.
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.
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

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
The next component required to run MODX is a database server. This post will install and use the MariaDB database server.
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.
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.
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.
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.
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
Upon successfully installing the MariaDB database server, create a blank database on the server specifically for the MODX application.
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:
sudo mariadb
Then run the commands below to complete the steps:
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
The last component you will need to run MODX is PHP-FPM. The MODX application is PHP-based and supports the latest versions of PHP-FPM.
Run the commands below to install PHP-FPM.
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
Let’s begin downloading and configuring the MODX files on Ubuntu Linux.
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.
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.
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.
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.
sudo nano /etc/nginx/sites-available/modx.conf
Then, copy and paste the content block below into the Nginx server block.
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.
Then, run the commands below to enable the virtual host and restart the Nginx server.
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
You may want to install an SSL/TLS certificate to secure your MODX site. Secure your MODX installation with HTTPS from Let’s Encrypt.
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.
http://modx.example.com/setup
A MODX installation wizard page should appear. Select the installation language and click Continue.

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

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

Next, click the Install button to begin the installation.

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

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

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.
Leave a Reply