如何使用nginx proxy_pass

时间:2013-07-04 16:54:43

标签: node.js nginx

如何在proxy_pass中指定网址路径。下面是nginx conf文件

location / {
    proxy_pass http://www.example.com/
}

网址http://www.example.com/会动态重定向到http://www.example.com/image/file.aspx?img=1

如何指定内部重定向到其他网址的网址。对此有任何帮助将非常有帮助

1 个答案:

答案 0 :(得分:0)

尝试使用你不需要代理的nginx HttpRewriteModule(tho)。 它采用以下格式:

rewrite regex         replacement                              flag
   |      |                |                                    |
rewrite   ^/    http://www.example.com/image/file.aspx?img=1 permanent;

然后:

location / {

    rewrite ^/ http://www.example.com/image/file.aspx?img=1 permanent;

}