【问题标题】:Nginx Configuration for Redirecting URL用于重定向 URL 的 Nginx 配置
【发布时间】:2016-12-13 08:52:10
【问题描述】:

我想重定向这样的 /atpf/xyz -> /atp/xyz,我有这样的配置,但似乎不起作用

location /atpfe {
    rewrite ^/atp/(.*)$ /$1 break;
    proxy_pass http://backend-atp;
}

有人可以推荐吗?

【问题讨论】:

  • 位置 /atpfe 与您问题中的任何一个 URI 都不匹配,rewrite 语句将 /atp/xyz 更改为 /xyz

标签: nginx reverse-proxy proxypass


【解决方案1】:

我把它改成这个并工作了:

  location /atpfe {
            rewrite ^/atpfe/(.*)$ /atp/$1 break;
            proxy_pass http://backend-atppub;
        }

不完全了解重写功能

【讨论】:

    猜你喜欢
    • 2023-03-11
    • 2016-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-30
    • 2015-09-17
    • 1970-01-01
    相关资源
    最近更新 更多