You'll end up with a fully functional Plausible Analytics instance running on a single low-cost VPS, served over HTTPS via Caddy, persisting data in ClickHouse and PostgreSQL, and surviving reboots. Total recurring cost: the price of the VPS — nothing more.
Prerequisites
- A VPS running Ubuntu 24.04 with at least 1 vCPU and 2 GB RAM (Hetzner CX22 at $4.15/month works; the CAX11 Arm at $3.29/month also works)
- A domain or subdomain you control (e.g.,
stats.example.com) with an A record pointing to the VPS IP - SSH access as a non-root user with
sudoprivileges - Ports 80 and 443 open in your firewall
- Docker 26+ and Docker Compose v2 installed (steps below install them if missing)
Step 1 — Update the System and Install Docker
- Update packages.
sudo apt update && sudo apt upgrade -y
- Install Docker using the official convenience script.
curl -fsSL https://get.docker.com | sudo sh
- Add your user to the
dockergroup so you don't needsudofor every Docker command.
sudo usermod -aG docker $USER
newgrp docker
- Confirm the Docker version.
docker version --format '{{.Server.Version}}'
Expected output (version may differ):
26.1.4
Step 2 — Create the Project Directory and Fetch Plausible Config
- Create a working directory.
mkdir -p ~/plausible && cd ~/plausible
- Download the official Plausible Community Edition compose file and the required configuration templates.
curl -fsSL https://raw.githubusercontent.com/plausible/community-edition/v2.1.1/docker-compose.yml -o docker-compose.yml
curl -fsSL https://raw.githubusercontent.com/plausible/community-edition/v2.1.1/plausible-conf.env -o plausible-conf.env
This pins you to v2.1.1 — the latest stable CE release at time of writing. Check github.com/plausible/community-edition/releases for newer tags before running in production.
Step 3 — Configure Plausible Environment Variables
- Generate a 64-character secret key.
openssl rand -base64 48
Copy the output. You'll paste it in the next step.
- Open
plausible-conf.envin your editor.
nano plausible-conf.env
- Set the following values. Replace every angle-bracket placeholder.
BASE_URL=https://stats.example.com
SECRET_KEY_BASE=<paste_the_64_char_key_here>
DISABLE_REGISTRATION=true
BASE_URL must match the domain you'll serve Plausible on — ClickHouse and the tracking script both depend on it.
DISABLE_REGISTRATION=true locks signups after you create your first account, which is the right posture for a private instance.
- Save and close (
Ctrl+O,Enter,Ctrl+X).
Step 4 — Add Caddy as a Reverse Proxy
The default Plausible compose file exposes port 8000 on localhost. You'll add Caddy as an additional service that handles TLS termination.
- Create a
Caddyfile.
nano ~/plausible/Caddyfile
- Paste the following, replacing the domain.
stats.example.com {
reverse_proxy plausible:8000
encode gzip
header {
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
X-Content-Type-Options "nosniff"
X-Frame-Options "SAMEORIGIN"
}
}
Caddy automatically provisions a Let's Encrypt certificate for the domain on first start.
- Open
docker-compose.ymland append acaddyservice plus a named volume. Find theservices:block and add:
nano ~/plausible/docker-compose.yml
Add the following under services: (mind the two-space indent):
caddy:
image: caddy:2.8.4-alpine
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
networks:
- plausible_network
depends_on:
- plausible
Then add the volumes under the top-level volumes: key (it likely already has db-data and event-data):
caddy_data:
caddy_config:
Make sure caddy is on the same network as the plausible service. The default compose file uses a network called plausible_network — confirm the name with:
grep -A3 'networks:' ~/plausible/docker-compose.yml | head -10
If the network name differs, update the caddy service block accordingly.
Step 5 — Start the Stack
- Pull all images.
docker compose pull
- Start everything in detached mode.
docker compose up -d
- Watch the logs until ClickHouse and Plausible finish initializing (usually 30–60 seconds).
docker compose logs -f plausible
Wait for a line resembling:
Access PlausibleWeb.Endpoint at https://stats.example.com
Press Ctrl+C to detach from the log stream.
Step 6 — Create Your Admin Account
Plausible CE does not seed an admin account automatically. You must register before locking signups.
- Open
https://stats.example.comin a browser. - Click Register and create your account.
- Verify your email — with a self-hosted instance, Plausible skips the email confirmation step by default unless you configure SMTP. You'll land directly on the dashboard.
If you set DISABLE_REGISTRATION=true before creating an account, unlock it temporarily:
# In ~/plausible/plausible-conf.env, change to:
# DISABLE_REGISTRATION=false
# Then:
docker compose up -d plausible
# Create the account, then set it back to true and restart again.
Step 7 — Enable Automatic Restarts on Reboot
The restart: unless-stopped policy in the compose file handles container-level restarts. Make the compose stack start on boot via a systemd unit.
- Create the unit file.
sudo nano /etc/systemd/system/plausible.service
- Paste the following (replace
youruserwith your actual username).
[Unit]
Description=Plausible Analytics
Requires=docker.service
After=docker.service network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/home/youruser/plausible
ExecStart=/usr/bin/docker compose up -d
ExecStop=/usr/bin/docker compose down
User=youruser
[Install]
WantedBy=multi-user.target
- Enable and start the unit.
sudo systemctl daemon-reload
sudo systemctl enable --now plausible.service
Verify It Works
Run these checks in order.
1. HTTPS certificate
curl -I https://stats.example.com
Expected: HTTP/2 200 and a strict-transport-security header in the response.
2. All containers running
docker compose -f ~/plausible/docker-compose.yml ps
Expected output: every service shows Up or running.
NAME IMAGE STATUS
plausible-caddy-1 caddy:2.8.4-alpine Up 2 minutes
plausible-db-1 postgres:16-alpine Up 2 minutes
plausible-events_db-1 clickhouse/clickhouse-server Up 2 minutes
plausible-plausible-1 ghcr.io/plausible/... Up 2 minutes
3. Tracking script reachable
curl -sI https://stats.example.com/js/script.js | head -5
Expected: HTTP/2 200 with content-type: application/javascript.
4. Reboot persistence
sudo reboot
# Wait ~60 seconds, then SSH back in:
docker compose -f ~/plausible/docker-compose.yml ps
All containers should be running without manual intervention.
Troubleshooting
Caddy shows certificate not yet valid or fails ACME challenge
Confirm the A record for stats.example.com resolves to your VPS IP (dig +short stats.example.com). Port 80 must be reachable for the HTTP-01 challenge. Check docker compose logs caddy for ACME error messages.
Plausible container exits immediately
Run docker compose logs plausible. The most common cause is a missing or malformed SECRET_KEY_BASE in plausible-conf.env. Regenerate it with openssl rand -base64 48 and restart.
ClickHouse keeps restarting on a 1 GB RAM VPS ClickHouse is memory-hungry at startup. Either upgrade to 2 GB RAM or add a 2 GB swap file:
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
DISABLE_REGISTRATION=true locked me out before I created an account
Set it to false, run docker compose up -d plausible, register, then set it back to true and restart.
Tracking events not appearing in the dashboard
Plausible filters out localhost and private IPs by default. Test from an external network or use the data-domain attribute on the script tag matching exactly the site you registered in the dashboard.
Next Steps
- Add a site: In the Plausible dashboard go to Settings → Sites → Add site and embed the generated
<script>tag on your property. - Configure SMTP: Set
MAILER_EMAIL,SMTP_HOST_ADDR, and related vars inplausible-conf.envto enable email reports and alerts. - Backups: The critical data lives in the
db-data(PostgreSQL) andevent-data(ClickHouse) named volumes. Schedule nightly dumps withdocker execand ship them off-VPS — Hetzner Object Storage at $0.023/GB is a cheap destination. - Upgrade: Pin a new version tag in
docker-compose.yml, rundocker compose pull, thendocker compose up -d. Plausible CE handles migrations automatically on startup.
With this setup you're paying for compute only — no per-pageview SaaS fees, no data leaving your infrastructure.