nginx 反向代理一个server下配置多个location域名问题标签:set,优先级,server,nginxlocation,location,headerX,com,proxy From: https://blog.51cto.com/yetaotao/5800557
当你设置两个location/时,当然只会匹配第一个了。你的意思是不是要配置两个域名?
server{
listen80;
server_namewww.1.com;
location/{
proxy_set_headerHost$host;
proxy_set_headerX-Real-IP$remote_addr;
proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
server{
listen80;
server_namewww.2com;
location/{
proxy_set_headerHost$host;
proxy_set_headerX-Real-IP$remote_addr;
proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
我是想设置:1.com/2这样的怎么设置啊?
nginx 反向代理一个server下配置多个location域名问题
当你设置两个location/时,当然只会匹配第一个了。你的意思是不是要配置两个域名?
server{
listen80;
server_namewww.1.com;
location/{
proxy_set_headerHost$host;
proxy_set_headerX-Real-IP$remote_addr;
proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
server{
listen80;
server_namewww.2com;
location/{
proxy_set_headerHost$host;
proxy_set_headerX-Real-IP$remote_addr;
proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
我是想设置:1.com/2这样的怎么设置啊?