【问题标题】:Proxy_Pass using Nginx on windowsProxy_Pass 在 Windows 上使用 Nginx
【发布时间】:2017-10-26 12:34:53
【问题描述】:

我正在尝试将 nginx 用于我在 Azure 上使用位置的托管网站。但即使我为谷歌配置 Nginx,我也会得到 404。

location /master 
{
proxy_pass http://www.google.com;   
}

【问题讨论】:

    标签: nginx


    【解决方案1】:

    有关proxy_pass 的网址详细信息,请参阅此线程

    Nginx proxy_pass only works partially

    你的配置

    location /master 
    {
       proxy_pass http://www.google.com;   
    }
    

    发送/master 也作为网址的一部分。这意味着您正在尝试访问http://www.google.com/master。所以这不起作用,因为它是 404。但是如果您在两个位置都添加尾随 /

    location /master/ 
    {
       proxy_pass http://www.google.com/;   
    }
    

    /master 不会作为请求 URL 发送。此外,这只会在短时间内起作用,因为您将获得 301 到 https://www.google.com。所以更好的是使用proxy_pass https://www.google.com/;

    【讨论】:

    • 你现在面临什么问题?
    • 我发现Nginx for Windows没有mod_proxy模块! :(
    猜你喜欢
    • 2014-04-09
    • 2012-10-02
    • 2023-03-12
    • 1970-01-01
    • 2020-11-15
    • 2023-03-08
    • 2016-04-12
    • 2021-02-24
    • 1970-01-01
    相关资源
    最近更新 更多