Skip to content

Instantly share code, notes, and snippets.

@waaeel
Created May 9, 2022 11:42
Show Gist options
  • Save waaeel/575d848e6d73cbaa9678183d5c745eed to your computer and use it in GitHub Desktop.
Save waaeel/575d848e6d73cbaa9678183d5c745eed to your computer and use it in GitHub Desktop.
nginx.conf for plausible nginx proxy
server {
listen 80;
server_name _;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
location = /js/script.js {
# Change this if you use a different variant of the script
proxy_pass https://plausible.io/js/script.js;
# Tiny, negligible performance improvement. Very optional.
proxy_buffering on;
# Optional. Adds a header to tell if you got a cache hit or miss
add_header X-Cache $upstream_cache_status;
}
location = /api/event {
proxy_pass https://plausible.io/api/event;
proxy_buffering on;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment