Skip to content

Plausible Analytics Β· deploy guide

Self-host Plausible Analytics Community Edition on a VPS

Install Plausible Community Edition (privacy-friendly web analytics) on a bashrack VPS with Docker Compose and automatic HTTPS.

about 20 minutes of hands-on time

Who it's for

Site owners who want cookie-free analytics with the data on their own server.

You'll need

  • An Ubuntu or Debian VPS with your SSH key
  • A domain, e.g. stats.example.com, with an A record to the VPS IP

Steps

  1. step 1

    Open only SSH and HTTPS

    Enable the firewall before exposing anything. Port 80 is needed for the certificate challenge and the redirect to HTTPS.

    bash
    sudo apt-get update && sudo apt-get install -y ufw
    sudo ufw allow 22/tcp
    sudo ufw allow 80/tcp
    sudo ufw allow 443/tcp
    sudo ufw --force enable
  2. step 2

    Install Docker

    Log in to the VPS as your sudo user and install Docker Engine with the official convenience script, then allow your user to run it.

    bash
    curl -fsSL https://get.docker.com | sudo sh
    sudo usermod -aG docker "$USER"
    newgrp docker
    docker compose version
  3. step 3

    Get the Community Edition files

    Clone the official repository. Its README names the current release branch β€” check it out so you run a released version.

    bash
    git clone https://github.com/plausible/community-edition plausible-ce
    cd plausible-ce
    git branch -r   # pick the latest release branch from the README, then:
    # git checkout <release-branch>
  4. step 4

    Configure the base URL and secret

    Create the .env file with your domain and a random secret, and let Plausible serve HTTPS itself on ports 80/443.

    bash
    touch .env
    echo "BASE_URL=https://stats.example.com" >> .env
    echo "SECRET_KEY_BASE=$(openssl rand -base64 48)" >> .env
    echo "HTTP_PORT=80" >> .env
    echo "HTTPS_PORT=443" >> .env
    cat > compose.override.yml <<'EOF'
    services:
      plausible:
        ports:
          - 80:80
          - 443:443
    EOF
  5. step 5

    Start it

    Start the stack, wait for the certificate, then open your domain and register the first (admin) account.

    bash
    docker compose up -d
    docker compose logs -f plausible

Security and upkeep

  • Register the admin account right away; registration can then be restricted in the configuration.
  • Back up the Docker volumes (PostgreSQL and ClickHouse data) regularly, e.g. with VPS automated backups where available.
  • Upgrade by following the release notes for the next release branch.

Official documentation