-
-
Save waaeel/575d848e6d73cbaa9678183d5c745eed to your computer and use it in GitHub Desktop.
nginx.conf for plausible nginx proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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