---
title: "Deploy Matomo Analytics + MariaDB"
description: "Privacy-friendly analytics with MariaDB and persistent volumes."
category: "Analytics"
url: https://railway.com/deploy/matomo-analytics-mariadb
---

# Deploy Matomo Analytics + MariaDB

Privacy-friendly analytics with MariaDB and persistent volumes.

**[Deploy Matomo Analytics + MariaDB on Railway](https://railway.com/template/matomo-analytics-mariadb)**

- **Creator:** leodev
- **Category:** Analytics
- **Total deploys:** 1

## Template content

### mariadb https://cdn.jsdelivr.net/gh/selfhst/icons/svg/mariadb.svg

- **Image:** mariadb:11

### matomo https://cdn.jsdelivr.net/gh/selfhst/icons/svg/matomo.svg

- **Image:** matomo:5.8.0-apache
- **Start command:** `/bin/sh -c "a2dismod mpm_event || true; a2dismod mpm_worker || true; a2enmod mpm_prefork || true; exec /entrypoint.sh apache2-foreground"`
- **Health check:** /
- **Public domain:** Yes

## Documentation

# 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:

```sh
/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.

## Similar templates

- [Bugsink](https://railway.com/deploy/bugsink) — Self-hosted Error Tracking. Sentry-SDK compatible
- [SubTrackr](https://railway.com/deploy/bscottsubtrackr) — Self-hosted Subscription Tracker
- [Ackee - Complete Setup](https://railway.com/deploy/ackee-complete-setup) — [Jul'26] Self-hosted analytics tool with MongoDB and Mongo Express.

Open this page in a browser: https://railway.com/deploy/matomo-analytics-mariadb
