Last active
August 29, 2015 14:12
-
-
Save wangtai/b3e633563ceae2356a7c to your computer and use it in GitHub Desktop.
nginx reverse proxy example
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
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