1
我有两个监听器80和777.端口80充当反向代理。而端口777做了一些额外的东西,并希望重定向到端口80.如何重定向到Nginx中的不同端口?我与重写尝试,但后来想通了,它仅用于路径的变化将请求重定向到不同的监听器nginx
###
server{
listen 80;
server_name _;
location/{
proxy_pass "http://upstream0;#" is included since links are not allowed in the post
}
}
server{
listen 777;
server_name _;
#doing some other extra stuf
//Want to redirect to port 80 under some condition
}
这可能吗?
感谢
proxy_pass在if条件中是不允许的,您应该使用location/{proxy_pass http:// $ host:80; } – 2014-04-26 15:47:14
根据上面的链接文档,proxy_pass指令允许的上下文之一是“if in location”,更新示例以明确指出 – cobaco 2014-04-29 17:30:44
这也不起作用,它在文档中不可用,我试过了它之前。 – 2014-04-29 20:51:56