---
title: "Deploy Matomo"
description: "Matomo 5 web analytics with MySQL, private auto-install and hourly reports"
category: "Analytics"
url: https://railway.com/deploy/matomo-1
---

# Deploy Matomo

Matomo 5 web analytics with MySQL, private auto-install and hourly reports

**[Deploy Matomo on Railway](https://railway.com/template/matomo-1)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/matomo-1/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** Analytics
- **Total deploys:** 1

## Template content

### MySQL https://devicons.railway.app/i/mysql.svg

- **Image:** mysql:8.4.13@sha256:a81d043930e51745522bd5c430961cf8286f0a23f0a9a2a6e0108f7ea71b0902
- **Start command:** `docker-entrypoint.sh mysqld --innodb-use-native-aio=0 --disable-log-bin --performance_schema=0 --innodb-buffer-pool-size=1G`

### Matomo https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/matomo.svg

- **Image:** matomo:5.14.2-apache@sha256:db40a508196ba5327a53dcae07d12835e50c7764bdaae3ea7822c35d432e64dc
- **Start command:** `sh -c "echo H4sIAAAAAAACA51Ya1vbOBb+7l9x6mHIZbAd6Gx36qyZTSEsmSUkmwDtLKF+FFtJtDi2a9kESvPf90hyrjjw7LYfUKRzkc71Pf7pnTVkocUn2k/QJmk0jSAKoUdYMCNPNkSjEfMYCWAqz+yqQWLiTSiwKRlT+AXSCePAU5KkwL2ExamJgjohhYcoyKYUSArWA0ms2WxmTdJpAGUv8ukBeFE4YuMDiINszEJ+AOk0rpjwmQ4PAH+nJAhoAiT0UVxC4wjlk8SbsAcWjgEPIclCJFT6I9SHAlPCQpqYGqcpGDTTGt2us6Fc6/dOHCvjicUTz1JP0jwf9D0k1TXNxtVzu3HVaXfc08ZV41Oj33TPO/0r+3chs+hkrhdzXfebvctGu1nMuTjdxd1t9PufO73TYu7FKXK/OOr0rpwigbhvG+/f1z4UMJ1+EncpYlMntpGoeCjgxT8Xzb7b7TXPWl+KRGwQ2IYyuruS1Dhtty6lQda4V5u2QfwpC1f0Z61e/8r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HCGXNEuFp+GL0cDQyWl01Iko4zjAIEKq2unU8PouSGUl86ouVkkZDn6/IhUQULIBwqysQ0wLvz6Is8BHNeZjrSIkjhbAGXtrU1no84hMeBTSHK7ZADSJGS/9QyWpiscDhwOUUmy0V8CaNvChwDkubZBiuHlJxzKqyAJlqvtfBATXiS6Qlx4BDEQ5yVatsCZF2dT00eZi6uXmd24F+fnXVdb+4vWbjwm11B/pdIZ8wfwHXWaf3udE7bZ7K7vqSWY2P7jBBMEkTd+k6zBg2HtMEl05ti+clsc+4nEJdGkpToIFwvlmmBTqu4fvSX36EBRTxcLSIG3lx5dAoS8FPojgWkExtEx99L76qKK+ip69bppYD0DMsSetCbu/Q4APEhOprzHyg6ztgLPpgsAn2CgJh+d4tJc6Gis2HFkpMqJ3FvoD4hvFEub6sEmiXDyb0tj+8BlEUQxnfGBAPk8RLorBiauUlmPxQw+VsguMp2PmUs/EW+ZliQ72SLfSryq/ic46Qc/kSS5foVU63OBgaIbzHtShMWJW+Wre5iDuwSlKfuspyqt3+zCaKpJyVKgiHNVmN5Pdr8T719UmUFflw+cVJx6GKepB/2zAwiug4ibLQ1/4LIW4p8jwXAAA= | base64 -d | gunzip > /tmp/start.sh && exec sh /tmp/start.sh"`
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# Deploy and Host Matomo on Railway

Matomo is an open-source web analytics platform and a self-hosted alternative to Google Analytics. It records page views, visitors, referrers, campaigns, goals and e-commerce sales from a JavaScript tracker or its HTTP API, and keeps all of that data in your own database, so you decide how long it is kept and who sees it.

## About Hosting Matomo

Matomo is a PHP application backed by MySQL or MariaDB. A normal install needs a web server, a one-time web installer and a cron job that turns raw visits into reports. This template runs all three in one service from the official Apache image, with Railway MySQL over the private network. On first boot it installs Matomo privately with your admin email and a generated password, so the public URL never shows an open installer. Code, config and plugins live on a volume. Browser-triggered archiving is off, and a loop in the same service builds the reports every hour. It reads the visitor IP from Railway's `X-Real-IP` header.

## Common Use Cases

* Privacy-friendly website analytics without sending visitor data to a third party
* Tracking several websites or apps from one dashboard, with goals, funnels and campaign reports
* Replacing Google Analytics where data ownership or GDPR compliance matters

## Dependencies for Matomo Hosting

* Matomo 5.14.2 (official `matomo:5.14.2-apache` image, pinned by digest) with a volume
* MySQL 8.4 (`mysql:8.4.13`, pinned by digest) with a volume

### Deployment Dependencies

* [Matomo source code](https://github.com/matomo-org/matomo) and [5.14.2 changelog](https://matomo.org/changelog/matomo-5-14-2/)
* [Official Docker image](https://github.com/matomo-org/docker) and [Matomo on-premise guides](https://matomo.org/faq/on-premise/)
* [Start script used by this template](https://github.com/aalfath/matomo-railway-template)

### Implementation Details

* **Sign in:** open your Railway domain and sign in as `admin` with the password in the Matomo service's `MATOMO_ADMIN_PASSWORD` variable. The admin email and password are read only on the first install, so change the password in Matomo afterwards.
* **First website:** set `MATOMO_FIRST_SITE_URL` before deploying, or edit "My website" later under Administration &gt; Websites &gt; Manage. Then copy the tracking code from Administration &gt; Websites &gt; Tracking Code into your site.
* **Reports:** they are built by the CLI archiver every hour (`MATOMO_ARCHIVE_INTERVAL`, in seconds), so new visits show up in reports after the next run. The Visits Log shows them at once.
* **Custom domain:** add it to Railway, then add it to `trusted_hosts[]` in `config/config.ini.php` on the volume (Administration &gt; System &gt; General settings), or set `MATOMO_PUBLIC_DOMAIN` to it.
* **Email:** set an SMTP server under Administration &gt; System &gt; General settings &gt; Email server settings, so password resets and scheduled reports can be sent.
* **Geolocation:** Matomo guesses the country from the browser language until you add a geolocation database under Administration &gt; System &gt; Geolocation.
* **Upgrades:** change the image tag. On the next start the new code is copied onto the volume and database updates run on their own.

## Why Deploy Matomo 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 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

- [Plausible WordPress](https://railway.com/deploy/deploy-plausible-for-wordpress-sites) — Cookie-free WordPress stats from your own Plausible
- [Typesense Multilingual](https://railway.com/deploy/deploy-typesense-multilingual-search) — Locale-aware multilingual search with Typesense
- [Formbricks](https://railway.com/deploy/formbricks-surveys) — Surveys, NPS and in-app feedback on your own Postgres, Hub and Cube

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