Whether you’re wanting to step away from third party giants collecting your users’ data or you’re just wanting to be more in control of the data you collect about your users, Plausible is an excellent solution for self-hosted analytics. To get started, you’ll need a machine to host your analytics panel on. We will be using Ubuntu 20.04 for our install but Plausible comes prepackaged in a Docker container which can run on any flavor of Linux.

More information about Plausible is available at https://plausible.io


  • A VPS with Ubuntu 20.04
  • A domain name
  • SMTP server (OPTIONAL)
Get a VPS at rawSRV.com starting at $9.50/m!

Step 1: Point your domain to your VPS IP address

These steps may vary for each domain registrar, this tutorial will explain how to point your domain to your VPS IP via CloudFlare.
  • Navigate to CloudFlare.com and login
  • Choose the domain you want to have your analytics on
  • Select “DNS” from the menu at the top of the screen
  • Click “Add Record”
  • Set “Type” to “A”
  • Set “Name” to the subdomain of your analytics (Eg. analytics)
  • Set “IPv4 address” to the IP Address of your VPS
  • Click “Save”

Step 2: Installing Docker on your VPS

Run these commands to update your system and install Docker:

sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
sudo apt install docker-ce -y

Docker should now been installed on your system, run the following command to verify this:

sudo systemctl status docker

If you see an output similar to this, Docker has been installed properly:

● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-05-26 07:52:47 CEST; 31s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 8900 (dockerd)
Tasks: 8
Memory: 40.8M
CGroup: /system.slice/docker.service
└─8900 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Step 3: Installing docker-compose on your VPS

Run these commands to update your system and install docker-compose:

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

To verify that docker-compose is installed on your machine, run the following command

sudo docker-compose --version

If you see an output similar to this, docker-compose has been installed properly:

docker-compose version 1.29.2, build 5becea4c

Step 4: Downloading the files for your Plausible Analytics server

Start by cloning Plausible’s repo and entering the directory by running the following commands:

sudo git clone https://github.com/plausible/hosting
cd hosting

In this directory you will see two important files, docker-compose.yml which is the file that will tell Docker which packages to download to run your Plausible analytics server and plausible-conf.env which is the configuration file for Plausible which we will be updating next.

Step 5: Configuring your Plausible Analytics server

Start by running the following command to generate a secure hash and copy it to your clipboard, we will use this in the configuration file:

sudo openssl rand -base64 64

Your file should look similar to this, open your plausible-conf.env file andyou’ll first want to set SECRET_KEY_BASE to the secure hash that you just generated previously. You’ll also want to fill out the credentials you will use to log into your analytics dashboard. Set your BASE_URL to the URL you set up in your DNS in Step 1.






Step 6: Adding SMTP credentials to you Plausible Analytics Server (OPTIONAL)

If you would like to add multiple users to your dashboard, get emailed password resets, and get weekly analytics information, please add the following variables to your plausible-conf.env file.

These variables will depend on which email provider you use, please ask your email provider for your credentials if you do not know them.
#The email id to use for as from address of all communications from Plausible.

#The host address of your smtp server. (DEFAULT: localhost)

#The port of your smtp server. (DEFAULT: 25)

#The username/email in case SMTP auth is enabled.
SMTP_USER_NAME=replace me

#The password in case SMTP auth is enabled.

#If SSL is enabled for SMTP connection (DEFAULT: false)

#Number of retries to make until mailer gives up (DEFAULT: 2)

Step 7: Starting your Plausible Analytics server

You’re now ready to start your Plausible Analytics server, please run the following command inside of the hosting directory where we downloaded all of the Plausible files:

sudo docker-compose up -d

This command should download all of the necessary packages for Plausible and output something similar to this, if you see this, your Plausible Analytics server has been installed properly:

Creating hosting_plausible_db_1        ... done
Creating hosting_plausible_events_db_1 ... done
Creating hosting_mail_1                ... done
Creating hosting_plausible_1           ... done
If you skipped Step 6, please run the following command to activate your account for your Plausible Analytics server.
sudo docker exec hosting_plausible_db_1 psql -U postgres -d plausible_db -c "UPDATE users SET email_verified = true;

Step 8: Installing NGINX

Your Plausible server is already running and available on port 8000 but it’s best to run a reverse proxy to avoid having to use the port to access your analytics dashboard and to encrypt your server with an SSL certificate.

Run the following command to install NGINX and it’s dependencies:

sudo apt-get -y install nginx certbot python3-certbot-nginx

To verify that NGINX is installed on your machine, run the following command:

sudo systemctl status nginx

If you see an output similar to this, NGINX has been installed properly:

● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-05-26 08:18:56 CEST; 18s ago
Docs: man:nginx(8)
Main PID: 12200 (nginx)
Tasks: 2 (limit: 2282)
Memory: 6.6M
CGroup: /system.slice/nginx.service
├─12200 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─12201 nginx: worker process

Step 9: Configuring NGINX as a reverse proxy

To configure NGINX as a reverse proxy, you need to add a file to sites-enabled directory, run the following command to edit this file:

sudo nano /etc/nginx/sites-available/analytics.conf

Paste the contents below into the file that you just created and change the server-name to the domain name you set in Step 1:

server {                                                                                                                                                   
    server_name change-me;                                                                                                                                    
    listen 80;                                                                                                                                                
    listen [::]:80;                                                                                                                                           
    access_log /var/log/nginx/reverse-access.log;                                                                                                             
    error_log /var/log/nginx/reverse-error.log;                                                                                                               
    location / {                                                                                                                                              
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;                                                                                                                    

You’ve now created a file that will tell NGINX to run a reverse proxy for your Plausible Analytics server but it isn’t enabled yet, run the following commands to enable it:

sudo ln -s /etc/nginx/sites-available/analytics.conf /etc/nginx/sites-enabled/analytics.conf

You now need to generate an SSL certificate for your domain to encrypt your traffic and keep your Plausible analytics server secure, run the following command to generate a free SSL certificate and follow the on-screen instructions:

If you run into an issue here when using CloudFlare as your DNS provider, change your DNS from the orange cloud icon to DNS only mode temporarily to get an SSL ceritificate generated.
sudo certbot --nginx

Now that you’ve enabled your site and installed an SSL certificate, you need to reload NGINX so your website is live, run the following command to reload NGINX:

sudo systemctl reload nginx

Step 10: Accessing your Plausible Analytics dashboard

Your Plausible Analytics server should be completely setup now and you can visit the domain you set in Step 1 to access your dashboard, use the credentials from Step 5 to login and view your new dashboard!