Deploy Matomo Analytics + MariaDB
Privacy-friendly analytics with MariaDB and persistent volumes.
mariadb
Just deployed
/var/lib/mysql
matomo
Just deployed
/var/www/html
Deploy and Host Matomo Analytics + MariaDB on Railway
Matomo is a privacy-friendly web analytics platform and a self-hosted alternative to Google Analytics. This Railway template deploys Matomo with MariaDB, persistent volumes, private database networking, and the Apache start-command fix required for the official Matomo image on Railway.
About Hosting Matomo Analytics + MariaDB
This template runs Matomo on the official matomo:5.8.0-apache image and stores analytics data in a private MariaDB 11 service. Matomo receives the public Railway domain while MariaDB stays private. Both services use persistent volumes so application state and database data survive redeploys. The Matomo service includes a healthcheck at / and starts Apache after disabling conflicting MPM modules, which avoids the common Apache multiple-MPM crash.
Common Use Cases
- Self-host privacy-friendly website analytics.
- Replace Google Analytics for product, marketing, or content sites.
- Run a sticky analytics dashboard with persistent MariaDB storage.
Dependencies for Matomo Analytics + MariaDB Hosting
- Matomo
5.8.0-apache. - MariaDB 11.
- Railway private networking and persistent volumes.
Deployment Dependencies
- Matomo Docker image: https://hub.docker.com/_/matomo
- MariaDB Docker image: https://hub.docker.com/_/mariadb
- Matomo documentation: https://matomo.org/docs/
Implementation Details
The Matomo service uses this start command so Apache loads mpm_prefork cleanly on Railway:
/bin/sh -c "a2dismod mpm_event || true; a2dismod mpm_worker || true; a2enmod mpm_prefork || true; exec apache2-foreground"
After deployment, open the generated Matomo domain and complete the setup wizard. Use the preconfigured MariaDB values from the template. MariaDB is not exposed publicly.
Why Deploy Matomo Analytics + MariaDB on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Matomo Analytics + MariaDB on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
mariadb
mariadb:11matomo
matomo:5.8.0-apache