在proxy_pass上没有位置url的Nginx代理传递

时间:2021-06-10 09:11:09

标签: nginx nginx-reverse-proxy nginx-config nginx-location

我正在尝试在 nginx 中代理传递。这是配置的样子:

location /amazon {
        proxy_pass http://amazon.com;
    }

当我打开 domain.com/amazon 时,它会将我带到 amazon.com/amazon。我应该如何编写它以便仅打开 amazon.com,而不打开 /amazon。

1 个答案:

答案 0 :(得分:1)

只需在 proxy_pass 后面添加一个斜杠:

proxy_pass http://amazon.com/;

这表示您要访问根 (/) 位置。

相关问题