Skip to main content
To self-host web analytics, run Matomo or PostHog with Docker on a Linux VPS and point your site’s tracking code at your own server. Your analytics data then sits in a database you control instead of with a third-party SaaS, and you aren’t billed per event. Self-hosting doesn’t make you compliant with privacy laws on its own: you still need a lawful basis, a privacy notice and, where required, consent for tracking. It does give you full control over where the data is stored and who can access it.

Deploy Matomo with Docker

  1. Order a FlashRDP Linux VPS with Ubuntu 22.04 or 24.04. SILVER suits most sites; choose GOLD for high traffic.
  2. Log in via SSH.
  3. Install Docker and the Compose plugin from Ubuntu’s repositories:
  4. Get Matomo’s official Docker example and move into the Nginx setup:
  5. Create a .env file with random database passwords, readable only by you:
  6. Start the stack:
  7. Open http://YOUR_SERVER_IP:8080 and complete Matomo’s setup wizard.
The example serves Matomo over plain HTTP on port 8080. Before you add tracking to a live site, put it behind a reverse proxy with HTTPS on your own domain (for example Nginx with Certbot, as in Host a Website with Nginx) and stop exposing port 8080 publicly: change 8080:80 to 127.0.0.1:8080:80 in compose.yml and run sudo docker compose up -d again. Ports published by Docker bypass ufw rules, so a firewall rule alone doesn’t close them.

Deploy PostHog (hobby setup)

PostHog offers a free Docker Compose “hobby” deployment under the MIT license. PostHog’s documentation lists at least 4 vCPU and 16 GB RAM, so use GOLD or above. PostHog doesn’t provide support for self-hosted instances and recommends its cloud product above a few hundred thousand events per month. See PostHog’s self-host docs for the current install command and limits before you start.
Data location: With a self-hosted setup, your analytics database lives on your FlashRDP server’s SSD storage in Phoenix, AZ or Paris, France, and nobody else’s tracking servers process it. Turn on backups or export the database regularly.

Host a Website with Nginx

Persistent Docker Deployments

Connect via SSH

Back Up and Restore Your Server

Last modified on October 16, 2026