Skip to content

Instantly share code, notes, and snippets.

@gerhard
Created May 30, 2012 12:18
Show Gist options
  • Save gerhard/2835913 to your computer and use it in GitHub Desktop.
Save gerhard/2835913 to your computer and use it in GitHub Desktop.
nginx multiple proxies
server {
listen 80;
server_name dashboard.foo.com;
upstream dashboard_backend {
server 11.11.12.40:5000 max_fails=3 fail_timeout=1s;
}
location /{
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Connection '';
proxy_pass http://dashboard_backend;
proxy_redirect off;
}
}
server {
listen 443;
server_name foo.com;
ssl on;
location /dashboard {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Connection '';
proxy_pass http://dashboard.foo.com;
proxy_redirect off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment