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
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.
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.
Start the containers
Run docker compose up -d. Matomo listens on internal port 80; the database starts in parallel.
Configure the reverse proxy
With Caddy: matomo.your-domain.com { reverse_proxy localhost:8080 }. Caddy obtains and renews the Let's Encrypt certificate automatically.
Complete the installation wizard
Open the URL, follow the web wizard (system check, database, admin account), then declare your first site.
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.