4.1.10 Deployment MODX Revolution on hosting and server

The Host Banner MODX

MODX is an open-source content management system (CMS) and framework (CMF) written in PHP, designed to create flexible, high-performance websites and web applications of any scale.

It combines the simplicity of content management with the power of a framework: developers can write custom components, while administrators manage content through the convenient MODX Manager panel.

Preparing the environment

Requirements

  • An active Hosting, Virtual, or Dedicated server plan
  • CPU: 1–2 vCPU; RAM: from 1 GB; SSD: from 5–10 GB
  • OS: Ubuntu 22.04 LTS or 24.04 LTS (recommended)
  • Stack: PHP 8.1–8.2 with mbstring, json, xml, zip, pdo, pdo_mysql; MySQL 5.7+/MariaDB 10.3+
  • Access: Root or a user with sudo privileges

Environment variables

  • DOMAIN_NAME — your site’s domain
  • DB_NAME, DB_USER, DB_PASSWORD, DB_HOST — database connection parameters (usually 127.0.0.1)
  • ADMIN_EMAIL — administrator’s email
  • UPLOAD_PATH — website directory path (for example, ~/www/DOMAIN_NAME)
  • MODX_VERSION — MODX version (for example, 3.0.6-pl)

Installing MODX on hosting

We’ll install the stable MODX version, configure the database, and set permissions. This method works for shared hosting and servers without Docker.

  1. Download the MODX Revolution distribution. Go to the official website and download the archive.

  2. Upload and extract the archive on the server. Upload the archive to your domain’s folder (~/www/DOMAIN_NAME) via FTP or file manager in your hosting panel.

  3. Create the database and user. Create the database via the panel or run the commands over SSH:

    Creating DB and user
    CREATE DATABASE DB_NAME CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    CREATE USER 'DB_USER'@'localhost' IDENTIFIED BY 'DB_PASSWORD';
    GRANT ALL PRIVILEGES ON DB_NAME.* TO 'DB_USER'@'localhost';
    FLUSH PRIVILEGES;
    
  4. Set write permissions for required directories.

    cd ~/www/DOMAIN_NAME
    find core/cache core/export core/packages assets -type d -exec chmod 775 {} \;
    find core/cache core/export core/packages assets -type f -exec chmod 664 {} \;
    chown -R WWW_USER:WWW_GROUP .
    

    This allows the installer to create configuration and cache files.

  5. Run the web installer. Open https://DOMAIN_NAME/setup/ and go through the wizard:

web-installation

  • installation type: New installation

web-installation-1

  • database access: DB_HOST, DB_NAME, DB_USER, DB_PASSWORD

web-installation-bd

  • leave the core/ path as default
  • enable Clean URLs (if rewrite is configured on the server)
  1. Remove the installer. Once done, click the delete setup/ button or remove the directory manually.

Tip! If you are migrating a site, import the database and the core/packages/ directory (with transport packages) first, then log into manager/ and clear the cache.

Configuring the web server for manual installation

Nginx

/etc/nginx/sites-available/modx.conf
server {
    listen 80;
    server_name DOMAIN_NAME;
    root /var/www/DOMAIN_NAME;
    index index.php index.html;

    location / {
        try_files $uri $uri/ @modx;
    }

    location @modx {
        rewrite ^/(.*)$ /index.php?q=$1 last;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
        fastcgi_read_timeout 120;
    }

    location ~* ^/(core|config.core.php) {
        deny all;
        return 403;
    }

    client_max_body_size 16m;
}

Create a symlink in sites-enabled, test the configuration with nginx -t, and restart the service.

PHP and extensions

See our guide for enabling PHP extensions in the hosting panel.

Update your php.ini: memory_limit=256M, upload_max_filesize=16M, post_max_size=16M, max_execution_time=120 Restart php-fpm.

Check:

php -v
php -m | grep -E "mbstring|pdo_mysql|xml|zip"
php -i | grep opcache.enable

Configuring additional MODX features

Configuring additional MODX features

Enabling SSL certificates

For HTTPS support, use Let’s Encrypt or a commercial SSL certificate.

Caching and performance

  • Enable cache in System Settings: cache_resource_default, cache_system_settings.
  • Activate OPcache in PHP.
  • For heavy pages, consider Nginx caching via proxy_cache at the reverse proxy level.

Backups

  • Database: mysqldump DB_NAME | gzip > backup-$(date +%F).sql.gz
  • Files: archive core/, assets/, config.core.php. Store backups outside the web root.

Verifying the installation

  1. Open https://DOMAIN_NAME/manager/ and log in.
  2. Create a “Home” resource, mark it as site_start, and enable Publish.
  3. Clear the cache in the admin panel and check the homepage.
  4. Make sure core/config/config.inc.php exists and isn’t accessible via web.
Common issues
Error / Symptom Cause Solution
404 on all pages Rewrite not working Enable Friendly URLs and verify Nginx/Apache rules
No records in core/cache Wrong directory rights Fix permissions on core/cache, assets
Database connection failed Incorrect DB_* values Verify login/host, recreate user
White screen / 500 error Missing PHP extension Install pdo_mysql, mbstring, zip
Manager not loading via HTTPS Mixed content issue Set site_url with https://