All posts

Blog

How to Self-Host Plausible Analytics (Community Edition) on a VPS

Illustrated cover for the Servers & VPS guide "How to Self-Host Plausible Analytics (Community Edition) on a VPS"

Many website owners want simple answers from their analytics: how many people visited, where they came from, and which pages they read. Heavy analytics suites can answer those questions, but they bring a large tracking script, complex dashboards and privacy headaches. Plausible Analytics takes a different approach: a small script, a single-page dashboard and no cookies.

Plausible offers a paid hosted service, and it also publishes a free, open-source Community Edition (CE) you can run yourself. This guide walks you through how to self-host Plausible Analytics on a VPS with Docker Compose.

Hosted vs self-hosted Plausible

Before you start, be clear about the trade-off:

  • Plausible's hosted service is maintained for you, with updates, backups and scaling handled by the Plausible team, for a subscription fee.
  • Plausible CE is free software (AGPL licensed) that you run on your own server. You handle installation, updates, backups and security. The Plausible team notes that CE doesn't include every feature of the hosted product and is supported by the community rather than by their support staff.

If you already manage a VPS and like keeping data on your own infrastructure, CE is a great fit. If you'd rather never think about servers, the hosted version may be better value for your time.

Requirements

According to the Community Edition documentation, you need:

  • A Linux server with Docker and Docker Compose installed. See our Docker on a VPS guide.
  • At least 2 GB of RAM. Plausible stores events in ClickHouse, which is memory-hungry.
  • A CPU with SSE 4.2 support (or NEON on ARM), required by ClickHouse. Most modern server CPUs have this, but some very old or unusual virtual CPUs don't.
  • A domain or subdomain for the dashboard, such as stats.example.com, with an A record pointing to the server.

Requirements can change between releases, so check the Plausible Community Edition repository before you begin.

Step 1: Prepare the server

Start with the security basics from first steps on a new Linux VPS: a sudo user, SSH keys, updates and a firewall that allows SSH, HTTP (80) and HTTPS (443).

Confirm Docker Compose is available:

docker compose version

Step 2: Clone the Community Edition repository

Plausible CE is distributed as a Git repository containing a Compose file and configuration. Clone a specific release tag (replace the version with the latest one listed in the repository's releases):

git clone -b v3.0.1 --single-branch https://github.com/plausible/community-edition plausible-ce
cd plausible-ce

Pinning a tag means you choose when to upgrade rather than getting surprised by changes.

Step 3: Configure the environment

Plausible reads its settings from a .env file. At minimum you need the public URL and a secret key:

touch .env
echo "BASE_URL=https://stats.example.com" >> .env
echo "SECRET_KEY_BASE=$(openssl rand -base64 48)" >> .env
  • BASE_URL must match the address you'll use to reach the dashboard.
  • SECRET_KEY_BASE signs sessions and must stay private. Never commit this file to a public repository.

Plausible CE can request its own Let's Encrypt certificate. To use that, the documentation has you expose ports 80 and 443 and set the HTTP and HTTPS ports in .env:

echo "HTTP_PORT=80" >> .env
echo "HTTPS_PORT=443" >> .env

Then create a compose.override.yml that publishes those ports for the Plausible service, as shown in the repository's README. Variable names and the exact override contents have changed between versions, so copy them from the README for the tag you cloned rather than from older tutorials.

Already running Nginx or another proxy?

If the server already uses ports 80 and 443 for other sites, skip Plausible's built-in HTTPS. Instead, publish Plausible's internal port on localhost only (for example 127.0.0.1:8000:8000) and proxy to it from Nginx, adding a certificate with Certbot. Our Let's Encrypt with Certbot guide covers the certificate side.

Step 4: Optional email settings

Plausible sends emails for account verification, password resets and weekly reports. To make that work reliably, configure SMTP settings (mailer address, host, port, username and password) in .env, using a transactional email service or your own mail server. The variable names are listed in the CE configuration docs. Without working email, some features such as password reset will not be available.

Step 5: Start Plausible

docker compose up -d

The first start downloads several images (Plausible, PostgreSQL and ClickHouse) and runs database migrations, so give it a minute or two. Check progress with:

docker compose ps
docker compose logs -f plausible

Once it's healthy, visit https://stats.example.com, register the first account (this becomes the admin), and create your first site.

Step 6: Add the tracking script to your site

When you add a site, Plausible shows you a script snippet to paste into your site's <head>. Copy the snippet from your own dashboard, because the script format has changed across versions and the dashboard always shows the right one for your install.

For WordPress, you can paste it with a header-scripts plugin, add it to your theme, or use Plausible's official WordPress plugin, which supports self-hosted instances.

After adding the script, open your site in a browser and check the Plausible dashboard. You should see a live visitor within a few seconds. Ad blockers sometimes block analytics scripts, so test in a browser without one.

Step 7: Lock down registration

After creating your account, prevent strangers from signing up on your instance. CE lets you control registration through an environment variable (commonly DISABLE_REGISTRATION, with options such as invite-only). Check the configuration docs for your version, set it in .env, and restart:

docker compose up -d

Backups and updates

Your analytics data lives in Docker volumes for PostgreSQL (accounts and site settings) and ClickHouse (event data). Back up both. A simple approach is to stop the stack briefly during a quiet period and archive the volume directories, or to use each database's own dump tools. Keep copies off the server, following the 3-2-1 backup rule.

To upgrade:

  1. Read the release notes in the CE repository; major versions can include migration steps.
  2. Fetch the new tag and check it out.
  3. Pull images and restart:
docker compose pull
docker compose up -d

Is self-hosted analytics privacy compliant?

Plausible is designed to avoid cookies and doesn't store personal data such as full IP addresses, which is why many site owners choose it. Still, privacy rules depend on where you and your visitors are. Review your privacy policy and, if you have specific legal obligations, get advice rather than assuming any tool makes you compliant automatically.

Wrapping up

Self-hosting Plausible Analytics gives you simple, lightweight, privacy-friendly stats on infrastructure you control. Make sure the server meets the RAM and CPU requirements, pin a release tag, keep .env secret, use HTTPS, disable open registration and back up both databases. In return you get clean traffic insights without a heavy script slowing your pages down.