How to Install MODX Revolution 3 on FreeBSD 15 (Apache, MariaDB, PHP)
A complete FAMP setup for MODX Revolution 3 on FreeBSD 15.1: packages, Apache and PHP configuration, building the GitHub release, web installer and cleanup.
MODX Revolution is an open-source PHP content management system that leaves the markup entirely to you: templates, chunks and snippets are assembled into pages without a theme layer in between. This guide installs MODX Revolution 3.2.4 (released on 26 August 2026) on FreeBSD 15.1 with Apache 2.4, PHP 8.4 and MariaDB, the classic FAMP stack. The same packages and paths apply to FreeBSD 14.5.
The release is taken from the project's GitHub repository, where every version is published as a tag. A tagged source archive does not contain the third-party libraries or the pre-built core package, so two extra commands (Composer and the MODX build script) prepare it before you open the web installer.
Requirements
- A FreeBSD 15.1 or 14.5 server with root access. The commands below are run as
root(log in as a normal user and usesu -); if you havesudoordoasconfigured, prefix them accordingly. - A DNS record such as
example.compointing to the server, and ports 80 and 443 open. - MODX 3.2 needs PHP 8.1 or newer with the curl, dom, gd, zlib, simplexml, pdo, xml, zip, xmlwriter and fileinfo extensions, plus a MySQL-compatible database.
Step 1: Install Apache, MariaDB and PHP
Update the package catalogue and installed packages:
pkg update
pkg upgrade
Install the web server, the database server, PHP 8.4 with the Apache module, the extensions MODX uses and Composer:
pkg install apache24 mariadb118-server mariadb118-client \
php84 mod_php84 php84-composer \
php84-curl php84-dom php84-gd php84-zlib php84-simplexml \
php84-pdo php84-pdo_mysql php84-xml php84-zip php84-xmlwriter \
php84-fileinfo php84-mbstring php84-iconv php84-intl \
php84-session php84-ctype php84-filter php84-tokenizer php84-opcache
FreeBSD names PHP packages after the PHP branch. If you prefer another supported branch, replace 84 in every package name; do not mix branches.
Step 2: Configure PHP and Apache
Create php.ini from the production template and set your time zone, which the MODX installer checks:
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
sed -i '' 's|^;date.timezone =.*|date.timezone = UTC|' /usr/local/etc/php.ini
The mod_php84 package registers the PHP module in httpd.conf but does not tell Apache which files to hand to it. Add that in a separate file:
cat > /usr/local/etc/apache24/Includes/php.conf <<'EOF'
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
EOF
MODX uses mod_rewrite for friendly URLs. The module is installed but commented out; enable it:
sed -i '' 's|^#LoadModule rewrite_module|LoadModule rewrite_module|' /usr/local/etc/apache24/httpd.conf
Create the virtual host. AllowOverride All lets the .htaccess files shipped with MODX take effect:
cat > /usr/local/etc/apache24/Includes/modx.conf <<'EOF'
<VirtualHost *:80>
ServerName example.com
DocumentRoot "/usr/local/www/modx"
<Directory "/usr/local/www/modx">
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog "/var/log/modx-error.log"
CustomLog "/var/log/modx-access.log" combined
</VirtualHost>
EOF
Step 3: Start MariaDB and create the database
Enable and start the database server. The MariaDB package uses the service name mysql-server:
sysrc mysql_enable=YES
service mysql-server start
mariadb-secure-installation
Answer the questions of mariadb-secure-installation to remove the anonymous accounts and the test database. Then open the client:
mariadb -u root
CREATE DATABASE modx CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'modx'@'localhost' IDENTIFIED BY 'choose-a-strong-password';
GRANT ALL PRIVILEGES ON modx.* TO 'modx'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 4: Download and build MODX
Fetch the 3.2.4 tag from GitHub and unpack it into the document root. --strip-components 1 drops the top-level folder of the archive:
fetch -o /tmp/modx-3.2.4-pl.tar.gz https://github.com/modxcms/revolution/archive/refs/tags/v3.2.4-pl.tar.gz
mkdir -p /usr/local/www/modx
tar -xzf /tmp/modx-3.2.4-pl.tar.gz -C /usr/local/www/modx --strip-components 1
Newer releases appear on the tags page of the repository; to install one, change the version in the URL.
Create the two build configuration files from their samples (no edits are needed), install the PHP libraries into core/vendor, and build the core package that the installer unpacks:
cd /usr/local/www/modx
cp _build/build.config.sample.php _build/build.config.php
cp _build/build.properties.sample.php _build/build.properties.php
composer install --no-dev
php _build/transport.core.php
Composer asks for confirmation when it runs as root; answer yes. The build script writes the core package to core/packages; wait until it returns to the prompt.
Protect the core directory with the access file MODX ships for that purpose, and give the files to the Apache user so the installer can write its configuration:
cp core/ht.access core/.htaccess
chown -R www:www /usr/local/www/modx
Check the Apache configuration, then enable and start the server:
apachectl configtest
sysrc apache24_enable=YES
service apache24 start
Step 5: Run the web installer
Open http://example.com/setup/ in a browser and follow the wizard:
- Choose your language and select New Installation.
- Database type
mysql, hostlocalhost, themodxuser, its password and the database namemodx. Useutf8mb4as the connection character set and keep themodx_table prefix. - Enter the name, e-mail address and password of the first administrator.
- Read the pre-installation checks. A missing PHP extension or an unwritable directory is listed here; fix it and reload the page.
- Start the installation. On the last screen leave the option to delete the setup directory selected.
The installer writes config.core.php in the web root, manager and connectors, and the main configuration under core/config/.
Step 6: Clean up and enable friendly URLs
The build directory is not needed at run time, and the setup directory must not stay reachable. Remove both:
rm -rf /usr/local/www/modx/_build /usr/local/www/modx/setup
Activate the rewrite rules that MODX ships:
cd /usr/local/www/modx
cp ht.access .htaccess
chown www:www .htaccess
Log in to the manager at http://example.com/manager/, open the system settings, search for friendly_urls and set it to Yes. Pages are then served under their aliases instead of index.php?id=….
Verify the installation
http://example.com/shows the default MODX start page.http://example.com/core/docs/changelog.txtreturns 403 Forbidden. If the file is displayed,core/.htaccessis missing orAllowOverride Allis not active for the document root.- In the manager, the system information report shows MODX Revolution 3.2.4-pl.
Apache problems are logged in /var/log/modx-error.log; MODX writes its own errors to core/cache/logs/error.log.
HTTPS and maintenance
Serve the manager over TLS before you use it for real work. Certbot is packaged for FreeBSD under a name that includes the Python version; find it with pkg search certbot, install the main package and its Apache plugin, and request a certificate for example.com. Afterwards set the server_protocol system setting to https.
- Upgrades: back up the database and the web root, unpack the new tag over the existing files, repeat the Composer and build commands from Step 4, and open
/setup/again, this time choosing the upgrade option. Remove_buildandsetupwhen it is done. - Backups: dump the database with
mariadb-dump modx > modx.sqland archive/usr/local/www/modx, includingcore/config/config.inc.php. - System updates:
pkg upgradeupdates Apache, PHP and MariaDB; restart Apache afterwards withservice apache24 restart.
The project's own documentation is at docs.modx.com.
Frequently asked questions
Is there a ready-made archive that does not need the build step?
Yes. The MODX download page offers a pre-built zip of each release that already contains core/vendor and the core package; you unpack it and go straight to /setup/. The GitHub tag used here is the same source code and has a stable, scriptable URL, at the cost of the Composer and build commands.
Can I use PHP-FPM instead of mod_php?
Yes. MODX only needs PHP 8.1 or newer with the listed extensions, however it is connected to the web server. With PHP-FPM you install php84 without mod_php84, enable php_fpm with sysrc and point Apache at it through mod_proxy_fcgi.
Why should the core directory be blocked?
It holds the configuration file with the database password, the cache and the error log. MODX ships core/ht.access to deny all web access to it; the project also supports moving core outside the document root entirely, which the advanced installation documentation describes.
Does MODX 2.x still receive updates?
The repository still publishes 2.8 maintenance tags (2.8.9 in July 2026), but new sites should start on the 3.x branch, which is where features are developed.