0
点赞
收藏
分享

微信扫一扫

nginx api反代去掉/api前缀


我们将前后端分离的前端部署用nginx实现,
在location /部署上前端的web,

location /{
            root /software_install/xxx/web;
            index index.html index.htm;
        }

使用^~开头,这样会去掉/api前缀。例如访问/api/user,实际反代回去的请求url会是/user

location ^~/api/{
            proxy_pass http://localhost:8080/;
        }


举报

相关推荐

0 条评论