【问题标题】:proxy_pass return redirect in nginxproxy_pass 在 nginx 中返回重定向
【发布时间】:2018-12-20 20:45:37
【问题描述】:

我只是一个初学者,目前正在学习nginx。 我在使用 nginx 的 proxy_pass 功能时有疑问,所以我有疑问。

我的网站是 test.com(只是示例)。

http://test.com/aaa (This is example address)

-> aaa 返回到 '/login/login.cgi'

而我想要的是

http://test.com/aaa/login/login.cgi

但我只是重定向到

http://test.com/login/login.cgi

这是我的 nginx 配置(删除了不必要的代码)

server {
    location /aaa {
        proxy_pass http://192.168.0.1/;
    }
}

我该如何解决?

感谢您的阅读。

【问题讨论】:

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


    【解决方案1】:

    proxy_pass http://192.168.0.1/<-- 任何你放在最后的...

    location /aaa <-- 替换你放在这里的任何东西。

    所以在你的情况下,/aaa/ 取代。

    要保留/aaa,您只需删除proxy_pass 末尾的斜线,如下所示:

    proxy_pass http://192.168.0.1

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-04-12
      • 1970-01-01
      • 2013-06-04
      • 2021-02-24
      • 2016-01-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多