微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

旧站点和新站点的 Nginx 反向代理

如何解决旧站点和新站点的 Nginx 反向代理

我正在尝试为我的应用设置反向代理。目前该应用程序是用 angularjs 编写的。新的在 vue 中。我希望通过慢慢移动页面到 vue 来整合这两个应用程序。问题是我很难正确设置它。

angularjs -> www.example.com Vue -> www.example.com/vue/

但是,当我尝试 www.example.com/vue/sales/12/ 时,它无法正确解析。任何帮助将不胜感激。

location ^~ /vue  {
    rewrite /vue(/?(.*)) /$2 break;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Protocol $scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_hide_header X-Powered-By;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    alias /opt/projects/vue/current/dist;
    #index index.html;
    try_files $uri $uri/ /index.html;
    #break;
}
location / {
    alias /opt/projects/example/current/dist/;
    expires 2h;

}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。