Skip to content

Instantly share code, notes, and snippets.

@candale
Created September 2, 2017 12:06
Show Gist options
  • Save candale/e81f87cc670f2912e72e6b9df37bbd82 to your computer and use it in GitHub Desktop.
Save candale/e81f87cc670f2912e72e6b9df37bbd82 to your computer and use it in GitHub Desktop.
Multiple Netdata from same nginx
upstream local {
server localhost:19999;
keepalive 64;
}
upstream some_other {
server some_other:19999;
keepalive: 64;
}
server {
# nginx listens to this
listen 80;
# the virtual host name of this
server_name status.your_server.com;
location = {
return 301 /default_app;
}
location = / {
return 301 /default_app;
}
location ~ /(?<behost>.*)/(?<ndpath>.*) {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_pass_request_headers on;
proxy_set_header Connection "keep-alive";
proxy_store off;
proxy_pass http://$behost/$ndpath$is_args$args;
gzip on;
gzip_proxied any;
gzip_types *;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.netdata_htpasswd;
}
location ~ /(?<behost>.*) {
return 301 /$behost/;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment