Deployment guide

How to Host Matomo on a VPS

Deploy on a VPS Cloud →

Self-hosting8 min read

How to Host Matomo on a VPS

Matomo is the most complete open-source alternative to Google Analytics: detailed reports, heatmaps, funnels, goal tracking. Self-hosted on your VPS, it guarantees you 100% ownership of your audience data, with no sampling and no sharing with an ad network. Here is how to deploy it with Docker, MariaDB, a reverse proxy and a TLS certificate.

Why self-host Matomo on a VPS

Matomo offers the feature richness of the major analytics solutions while leaving you the owner of the data. When self-hosted, none of your visitors' data is passed to a third party, you avoid report sampling, and you freely enable the advanced features. A dedicated VPS sizes the MariaDB database to your traffic and keeps the entire history under your control.

The concrete benefits of a self-hosted Matomo

  • 100% ownership of the audience data, with no transfer to a third party.
  • Complete, unsampled reports, even at high volume.
  • Advanced features (heatmaps, funnels, goals) that you can freely enable.
  • Easier GDPR compliance thanks to IP anonymisation and Do Not Track support.
  • Fixed cost, with no billing by volume of hits.

Hardware and software requirements

Count on 2 vCPU and 2 GB of RAM to start, 4 GB for heavy traffic, as the MariaDB database grows with the history. Plan for 10 GB of disk or more. On the software side: Docker and Docker Compose, a subdomain (e.g. matomo.your-domain.com) pointing to the VPS, and port 443 open.

Deploy Matomo with Docker and HTTPS

01

Prepare the VPS and Docker

Over SSH, update the system and install Docker via curl -fsSL https://get.docker.com | sh. Create mkdir -p /opt/matomo && cd /opt/matomo.

02

Write the docker-compose.yml

Define two services: matomo (official image) and mariadb. Mount one volume for /var/www/html and one for the database, and fill in the MySQL connection variables.

03

Start the containers

Run docker compose up -d. Matomo listens on internal port 80; the database starts in parallel.

04

Configure the reverse proxy

With Caddy: matomo.your-domain.com { reverse_proxy localhost:8080 }. Caddy obtains and renews the Let's Encrypt certificate automatically.

05

Complete the installation wizard

Open the URL, follow the web wizard (system check, database, admin account), then declare your first site.

06

Install the script and the cron

Insert the tracking code into the <head> of your pages, and schedule core:archive via cron for fast reports at high volume.

For performant reports at high traffic, disable archiving on browser load and schedule the core:archive task every hour via cron: the dashboards then load instantly.

The official documentation

For advanced configuration and options specific to the tool, refer to the official Matomo documentation. This guide covers going live on a VPS; the vendor's documentation remains the reference for fine-tuning, major updates and specific use cases.

Deploy your instance on a ServOrbit Cloud VPS

A ServOrbit Cloud VPS with Docker preconfigured and scalable resources lets you install this tool without friction, and adjust RAM and vCPU as usage grows.

Need help?

Browse our help center and FAQ, or write to our team — support in French, English and Arabic.