Skip to content

Instantly share code, notes, and snippets.

@wangtai
Last active August 29, 2015 14:12
Show Gist options
  • Save wangtai/b3e633563ceae2356a7c to your computer and use it in GitHub Desktop.
Save wangtai/b3e633563ceae2356a7c to your computer and use it in GitHub Desktop.
nginx reverse proxy example
upstream main {
server web1.local:80;
server web2.local:80;
server web3.local:80;
}
location /some/path/ {
if ($host ~* "(.+)\.test\.bugua\.com$") {
set $new_host $1.bugua.com;
}
proxy_set_header Host $new_host;
#proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "";
proxy_buffers 16 4k;
proxy_buffer_size 2k;
#proxy_pass http://localhost:8000;
proxy_pass http://main;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment