October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Self-Host Matomo Analytics on Your Own VPS (2026 Guide)

Install Matomo Analytics on a VPS with the right CPU, RAM, storage, PHP, database, HTTPS, cron archiving, Docker persistence, privacy controls, backups, and scaling plan.
Length12 min Posted Quest giverVGSources Team

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can run Matomo On-Premise on a VPS you control instead of sending analytics data to a hosted service. A production installation needs a supported web server, PHP, MySQL or MariaDB, HTTPS, a dedicated database account, scheduled report archiving, backups, and a privacy plan. For a small site, Matomo’s published starting point is 2 CPUs, 2 GB of RAM, and a 50 GB SSD; traffic, retention, plugins, and concurrent users determine whether you need more.

This guide walks through planning, installation, tracking, cron or systemd archiving, Docker deployment, hardening, GDPR-oriented settings, backups, and scaling. The examples fit a game site or any other site that needs first-party control of its analytics database.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What self-hosted Matomo is and how the stack fits together

Matomo On-Premise is the downloadable edition of Matomo Analytics. You install it on infrastructure you administer, keep its database on that infrastructure, and expose the dashboard through a domain such as analytics.example.com. Matomo’s own description is direct: “Self-host Matomo Analytics on your own servers to ensure data remains in your hands!”

The installation has four practical layers:

  • Web server: Nginx or Apache accepts browser requests, serves Matomo, and terminates HTTPS directly or behind a reverse proxy.
  • PHP runtime: Matomo runs as a PHP application. Matomo recommends the latest PHP 8.x release for efficiency and speed, together with the extensions required by the installer.
  • Database: MySQL 8 or newer, or MariaDB, stores configuration, visits, actions, and archived reports. Use a database and account dedicated to Matomo.
  • Background processing: Cron or a systemd timer runs report archiving so visitors do not trigger expensive recalculation when they open reports.

Your tracked sites send page-view and event requests to the Matomo endpoint. The dashboard reads the resulting data from the same VPS or from a database server you place on a separate machine as you scale.

Choose VPS capacity before installing

Use Matomo’s published figures as starting points, not guarantees. Storage grows with raw visitor logs, actions, goals, plugins, report archives, and backup copies. The archive workload also changes with the number of sites and the number of people opening reports at the same time.

Workload Matomo guidance Deployment implication
Small installation 2 CPUs, 2 GB RAM, 50 GB SSD A single VPS can host the web application, database, and scheduled archiving when traffic and reporting load are modest.
About 1 million page views per month 4 CPUs, 8 GB RAM, 250 GB SSD A single server remains possible, but leave headroom for database growth, backups, and concurrent report users.
About 10 million page views per month Separate application and database capacity Plan a split architecture and measure database, PHP, and archiving load before adding more application nodes.

Estimate disk from your retention policy rather than page views alone. A site that keeps detailed raw logs for a year can need much more storage than one that deletes them after a few months. Keep backup space outside the production disk so a full database cannot prevent recovery.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

VPS prerequisites

  • SSH access with an account that can receive security updates and manage services.
  • A supported Linux distribution kept current with security patches.
  • A routable domain or subdomain, for example analytics.example.com, pointed at the VPS address.
  • Enough SSD capacity for the database, Matomo files, temporary imports, logs, and at least one tested backup workflow.
  • A firewall policy that exposes only the web ports and the SSH access you actually need. Do not expose MySQL or MariaDB directly to the public internet.

Prepare the server and domain

  1. Create the VPS and an administrative path. Use a non-root SSH account with privilege escalation, disable unused services, and apply the operating system’s current updates. Restrict SSH by key, source address, or an additional access control layer where practical.
  2. Create the DNS record. Point the analytics subdomain at the VPS and wait for DNS resolution before running the web installer. If your provider offers both IPv4 and IPv6, ensure the web server listens correctly on every published address.
  3. Install the web server, PHP 8.x, and database server. Package names and PHP extensions differ by distribution. Use the current PHP 8.x release supported by your Matomo version and enable every extension reported as required by the Matomo system check.
  4. Set service boundaries. Run the web server and PHP workers with a service account that does not have unnecessary shell or filesystem privileges. Keep the database bound to localhost when the application and database share one VPS.
  5. Set the firewall and TLS plan. Allow HTTP only long enough to obtain or redirect to a certificate, then serve the dashboard and tracking endpoint over HTTPS. Renew the certificate automatically and test renewal before production traffic arrives.

Create a least-privilege Matomo database

Make a database used only by Matomo and a database user used only by that database. Do not reuse the operating-system account, a general application account, or a full-privilege database administrator account.

During database setup, record the database name, username, host, port, and generated password in a password manager. The Matomo installer writes these values into its configuration, so protect that file with filesystem permissions and never commit it to a public repository.

If the database runs on another server, allow connections only from the Matomo application address, require encrypted transport where supported, and restrict the database firewall to that private network path. A public database listener turns a web-application mistake into a direct database attack surface.

Install Matomo with the web installer

Download Matomo from its official distribution channel, unpack it into the web root for the analytics subdomain, and make sure the web-server service account can read the application while writable directories have only the permissions the installer requires. Avoid placing unrelated websites or upload directories inside the same document root.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Open the subdomain in a browser. The installer runs a system check for PHP, extensions, writable paths, and database connectivity. Fix every required error before continuing; warnings should be understood rather than ignored.
  2. Enter database details. Supply the dedicated MySQL or MariaDB database, account, host, and port created earlier. The installer creates Matomo’s tables using that account.
  3. Create the super user. Use a unique administrator name and a long password that is not used anywhere else. Enable two-factor authentication if the Matomo version and your deployment support it.
  4. Add the first website. Enter the site name and canonical URLs for the game site or other property you are measuring. Add separate Matomo sites when domains need independent goals, users, or retention decisions.
  5. Copy the tracking tag. Matomo generates JavaScript for the site. Place it in the shared page template so it loads on every page where measurement is intended. Add event or ecommerce calls only after the basic page-view flow works.
  6. Finish the installer and remove installation exposure. Confirm that the configuration file is protected, the installer cannot be rerun by an unauthorised visitor, and directory listings are disabled.

Open Matomo’s real-time view while visiting the site in a private browser window. Confirm that a visit arrives before tuning goals, custom dimensions, or campaign parameters. If no visit appears, inspect the browser’s network requests, the web-server access log, and the Matomo URL configured in the tag.

Configure HTTPS and administrative protection

Use HTTPS for both the dashboard and the tracking endpoint. Secure cookies, authenticated sessions, and analytics payloads should not travel over plaintext connections. Redirect HTTP to HTTPS and verify that the reverse proxy, web server, and Matomo agree on the original scheme so secure links and cookies are generated correctly.

  • Keep Matomo on a dedicated subdomain rather than mixing it with a public content directory.
  • Block access to configuration files, private storage, backups, and version-control metadata at the web-server layer.
  • Limit administrator access by VPN, firewall source rules, an identity-aware proxy, or a separate administrative hostname when your operating model permits it.
  • Use strong, unique administrator credentials and two-factor authentication where available.
  • Apply operating-system, PHP, web-server, database, and Matomo security updates on a defined schedule.
  • Monitor disk usage, database errors, PHP worker saturation, failed logins, and certificate expiry.

Set up report archiving with cron or systemd

Scheduled archiving is part of a production Matomo deployment. Matomo’s installation guidance warns: “If you do not setup the cron, Matomo will recalculate your statistics every time you visit a Matomo report, which will slow Matomo down and increase the load on your database.” Without a scheduler, a dashboard request can start work that should have run in the background.

  1. Choose a scheduler account. Run the archive command as the Matomo service account or another account with the minimum filesystem and database access needed. Do not run routine analytics jobs as an unrestricted root user.
  2. Use the Matomo console archiving task. The command is part of the Matomo installation and should be invoked by cron or a systemd timer at a regular interval appropriate to your reporting freshness requirements.
  3. Prevent overlap. Use a lock or a scheduler setting that stops a second archive process from starting while the previous one is still running.
  4. Capture output. Send standard output and errors to a protected log, then alert on failed runs, unusually long runtimes, or repeated database errors.
  5. Validate the result. Run an archive manually after installation, open a report, and verify that the report loads without triggering a long recalculation.

On a busy installation, archive duration is an operational metric. If jobs consistently run into the next scheduled interval, increase application or database capacity, reduce unnecessary plugins and retention, or move the database to dedicated hardware.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Docker when containers fit your operating model

Matomo publishes an official Docker image and documents a Compose-style arrangement with separate application, database, and cron services. Containers can make repeatable deployments and upgrades easier, but they do not remove operational responsibilities.

  1. Define persistent storage first. Keep Matomo configuration, plugins, and database data in named volumes or host paths that survive container replacement. Ephemeral container files are not a backup strategy.
  2. Pin image versions. Avoid an unbounded floating tag in production. Choose a tested Matomo image version, record the change, and update deliberately.
  3. Expose only the reverse proxy. Publish the HTTPS proxy to the internet; keep the application, database, and cron services on the private container network. Do not publish the database port publicly.
  4. Back up volumes and configuration. A database dump alone may omit plugins or configuration, while a file copy alone may not produce a consistent database backup. Protect both and test restoration.
  5. Run cron as a separate service or scheduled container task. Confirm that the archive job can reach the application and database volumes and that logs are retained outside the disposable container.
  6. Plan upgrades and rollback. Read the Matomo upgrade notes for the selected image, take a fresh backup, stage the update when possible, and keep the previous image available until health checks pass.

Make privacy settings part of the measurement design

Self-hosting keeps the analytics database under your control, but it does not automatically make collection lawful. Matomo notes that IP addresses can be personal data under the GDPR. Decide what you need to measure before enabling identifiers, and document the decision for each site.

IP addresses and server logs

Enable IP masking or full anonymisation before production collection. Matomo can mask the IP before storing it in the analytics database, but the unmasked address may still appear in web-server access logs. Rotate, restrict, and delete those logs under a separate policy; masking in Matomo does not erase data already written by the web server.

Cookies, user IDs, and geolocation

Choose whether cookies are necessary for your reports. Treat User IDs, precise geolocation, and detailed referrer information as optional data collection, not default features. If a measurement question can be answered without a persistent identifier or precise location, leave that feature disabled or reduce its precision.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Consent and lawful basis

Determine the lawful basis for analytics in every jurisdiction where visitors live. Matomo’s consent guidance explains that consent may be required in some circumstances; jurisdiction-specific legal advice remains necessary. Configure an opt-out or consent mechanism that matches your policy, and make the choice visible rather than burying it in a settings page.

Retention and deletion

Set a deletion schedule for detailed raw visitor logs. Matomo recommends retaining those logs for only three to six months for privacy reasons, subject to operational requirements. Keep aggregated reports only as long as they serve a documented purpose, and verify that deletion jobs actually remove the intended records.

Backups, updates, and recovery

A VPS can fail, be compromised, or run out of disk. Back up the database, Matomo configuration, custom plugins, and any files needed to recreate the deployment. Store copies off the VPS and protect them with access controls and encryption appropriate to the data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Database consistency: use a database-aware dump or snapshot process rather than copying live table files blindly.
  • Configuration recovery: include Matomo’s configuration and any customised themes, plugins, or cron definitions.
  • Retention: keep multiple restore points so a corrupt or deleted report is not replicated into every backup.
  • Testing: restore to an isolated VPS at intervals, log the recovery time, and confirm that tracking and archived reports work.
  • Upgrade safety: back up before Matomo, PHP, database, or operating-system upgrades and monitor the first archive run afterward.

Define recovery objectives in practical terms: how much recent analytics data you can afford to lose and how long the dashboard may be unavailable. Those objectives determine backup frequency, off-server storage, and whether a second application or database node is justified.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Know when a single VPS is no longer enough

A single VPS is appropriate when database, application, and cron load are modest. Rising page views are only one signal. Watch database CPU and I/O, PHP worker queues, archive duration, disk growth, report latency, and concurrent dashboard users.

  1. First, tune the existing host. Remove unused plugins, shorten unnecessary raw-log retention, keep PHP and the database current, and ensure archiving runs on schedule.
  2. Next, separate the database. At larger volumes, place MySQL or MariaDB on dedicated capacity with private networking, controlled firewall rules, monitoring, and its own backup plan.
  3. Add application capacity. Multiple Matomo application nodes require shared or replicated configuration and plugin files plus a consistent session strategy.
  4. Introduce a load balancer and CDN only when justified. These components help with availability and delivery, but they add certificates, health checks, cache rules, and another layer to troubleshoot.
  5. Reassess retention and reporting. A shorter raw-log window and fewer expensive custom reports can delay or avoid a larger architecture without sacrificing the metrics your team actually uses.

Compare each scaling option on monthly page views, retention period, report latency, backup and restore objectives, operator skill, and tolerance for maintenance. Capacity without an operating plan simply moves the failure point.

Troubleshooting common installation failures

The installer reports missing PHP requirements

Install the extension named by the Matomo system check for your distribution’s PHP 8.x package, restart the PHP service, and rerun the check. Do not suppress a required warning; the installer is identifying a runtime dependency that reports may need later.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The database connection fails

Verify the database host and port, confirm that MySQL or MariaDB is running, check the account’s permissions on the Matomo database, and inspect the database firewall. If the database is remote, test private-network reachability and TLS settings rather than opening the port to all addresses.

Tracking requests arrive but reports are empty or slow

Use real-time reports to separate collection from archiving. If real-time visits exist, inspect cron or systemd logs, run one archive task manually, and check for overlapping jobs, database errors, or insufficient disk. If real-time data is absent, inspect the page source and browser network requests for the tracking URL and HTTPS errors.

HTTPS redirects loop or secure cookies fail

Check the reverse proxy’s forwarded-scheme headers and the web server’s HTTPS configuration. Matomo must receive the correct original scheme; otherwise it may generate HTTP URLs behind an HTTPS proxy or repeatedly redirect requests.

The VPS runs out of storage

Measure database tables, raw logs, archived reports, web-server logs, temporary files, and backups separately. Delete data only under your documented retention policy, move backups off-server, and increase the SSD before the database reaches a full-disk condition that can corrupt writes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When self-hosting is the right choice

Self-host Matomo when control of the analytics database, custom retention, and first-party deployment justify the work of patching servers, monitoring jobs, protecting backups, and responding to failures. A managed service can reduce that operational burden, but it also changes where data and administrative control reside.

For a small game site, the 2-CPU, 2-GB RAM, 50-GB SSD baseline is a sensible starting point if you monitor growth and keep backups elsewhere. Move to the 4-CPU, 8-GB RAM, 250-GB SSD guidance around one million monthly page views, and plan separate application and database capacity near ten million monthly page views. In every case, scheduled archiving, deliberate privacy settings, updates, and tested recovery are part of the installation rather than optional refinements.

“If you do not setup the cron, Matomo will recalculate your statistics every time you visit a Matomo report, which will slow Matomo down and increase the load on your database.”

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.