V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
littlepython
V2EX  ›  NGINX

nginx 重定向配置问题

  •  
  •   littlepython · 2019-06-24 12:51:53 +08:00 · 2264 次点击
    这是一个创建于 1739 天前的主题,其中的信息可能已经有所发展或是发生改变。

    nginx 配置重定向 nginx 服务器 ip 为 172.1.10.111 监听端口为 8003

    如果我要访问 http://172.16.1.111:8003/http://172.16.1.123:8084/group3/M00/DA/A7/rBABiV0QQp2Ac6IhAAaMhQ_DNiE133.jpg 直接重定向到 http://172.16.1.123:8084/group3/M00/DA/A7/rBABiV0QQp2Ac6IhAAaMhQ_DNiE133.jpg

    可以在 nginx.conf 中如何配置? 或者说别的什么方法直接在 nginx 实现 就是想直接跳转后面的 url

    3 条回复    2019-07-10 11:26:05 +08:00
    15651980765
        1
    15651980765  
       2019-06-24 13:25:28 +08:00
    百度 2 分钟,论坛 2 小时(笑~)
    15651980765
        2
    15651980765  
       2019-06-24 13:29:36 +08:00
    另外一般不都是 ip1:port1/api/...代理到 ip2:port2/...(其中 api 是关键词,用来做代理配置)
    liwb2
        3
    liwb2  
       2019-07-10 11:26:05 +08:00
    location / {
    rewrite ^http://172.16.1.111:8003/http://172.16.1.123:8084/(.+)$ http://172.16.1.123:8084/$1 redirect
    }
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3353 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 13:39 · PVG 21:39 · LAX 06:39 · JFK 09:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.