首页  >  问答  >  正文

nginx映射问题

我在域名为xx.com的服务器下搭建了一个5000端口的服务a,
想通过nginx做一层映射
把http://xx.com/a 映射到 xx.com:5000上,

nginx conf 是这样写的

location /a{
    rewrite ^/a/(.*)/ break
    access_log off;
    proxy_pass http://127.0.0.1:5000
}

现在的问题是 输入http://xx.com/a/ 能正确映射
但是 http://xx.com/a 却不能, 请问该修改

習慣沉默習慣沉默2689 天前462

全部回复(2)我来回复

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 17:24:16

    雷雷

    回复
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 17:24:16

    或许可以酱紫

    location /a{
        rewrite ^/a(/|?|#|$)(.*)/ break
        access_log off;
        proxy_pass http://127.0.0.1:5000
    }

    回复
    0
  • 取消回复