› NGINX
› NGINX Trac
› 3rd Party Modules
› Security Advisories
› CHANGES
› OpenResty
› ngx_lua
› Tengine
在线学习资源
› NGINX 开发从入门到精通
NGINX Modules
› ngx_echo
mrco
V2EX  ›  NGINX

请教一个 nginx 的 rewrite 写法。

  •  
  •   mrco · Apr 30, 2021 · 3008 views
    This topic created in 2013 days ago, the information mentioned may be changed or developed.

    x.city.cn/post/???? 到  ai.city.cn/???? 的 url rewrite 。

    感谢~~~

    6 replies  •  2021-04-30 14:36:36 +08:00
    zzl22100048
    zzl22100048
    Apr 30, 2021
    1
    不能用 proxy_pass 处理吗
    AoEiuV020
    AoEiuV020
    Apr 30, 2021
    2
    rewrite ^/post/(.*) http://ai.city.cn/$1 permanent;
    dier
    dier
    Apr 30, 2021
    3
    试试这个?
    ```
    server_name x.city.cn;
    location / {
    root html;
    }
    location /post/ {
    rewrite ^/post/(.*)$ http://ai.city.cn/$1;
    }
    ```
    mrco
    mrco
    OP
    Apr 30, 2021
    4
    @AoEiuV020 谢谢亲~
    mrco
    mrco
    OP
    Apr 30, 2021
    5
    @dier 谢谢亲~~~~
    qdporter
    qdporter
    Apr 30, 2021
    6
    location ^~ /post {
    proxy_pass ai.city.cn/
    }
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1319 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 21:11 · PVG 05:11 · LAX 13:11 · JFK 16:11
    ♥ Do have faith in what you're doing.