I'm trying to self host plausible analytics. So far I've installed docker, and started the docker containers. I've also ensured nginx is running, has a valid config, allowed ports 80 and 443 through ufw, and configured nginx with the domain: https://plausible.example.com
.
My nginx config looks like this:
server {
server_name plausible.example.com;
location / {
proxy_pass http://localhost:8000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
listen [::]:443 ssl; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/plausible.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/plausible.example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = plausible.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name plausible.example.com;
listen 80;
listen [::]:80;
return 404; # managed by Certbot
}
The problem is when I try to visit plausible.example.com
I get a 502 bad gateway
error. When I check the nginx error logs I get this error:
[error] 935230#935230: *579224 recv() failed (104: Unknown error) while reading response header from upstream
I've tried to find a solution to this error but I haven't been able too. Any help would be appreciated. Thanks.
Edit: I should also add that in the plausible env variables, the host name is: https://plausible.example.com