← Home

NGINX is a very efficient forward proxy and the ideal tool for this job.

The goal is to set up a proxy in front of Plausible that consumes very little memory.You can find the code below as repo, ready to deploy.

The Dockerfile is pretty basic:

FROM nginx
COPY nginx.conf /etc/nginx/nginx.conf
RUN mkdir -p /var/cache/nginx

CMD ["nginx", "-g", "daemon off;"]

We need to fetch the tracking script from Plausible:

...
    location = /js/script.js {
        # Change this if you use a different variant of the script
        proxy_pass https://plausible.io/js/script.js;
        proxy_set_header Host plausible.io;
    }
...

And forward requests to the event endpoint:

...
    location = /api/event {
        proxy_pass https://plausible.io/api/event;
        proxy_set_header Host plausible.io;
    }
...

NGINX sits at around 30MB-50MB memory for my workloads.

It should easily fit onto a 256MB VM.

← Home

Erben Systems GmbH

Watterstrasse 81, c/o Sarbach Treuhand AG, 8105 Regensdorf, Switzerland

CHE-174.268.027 MwSt