【问题标题】:Meteor, Angular routes, Nginx and SSL - how to route /path to another server with rewriteMeteor、Angular 路由、Nginx 和 SSL - 如何通过重写将 /path 路由到另一台服务器
【发布时间】:2016-03-31 22:00:53
【问题描述】:

我有:

  • DigitalOcean VPS
  • 在 Angular 中使用路由的 Meteor 应用程序
  • Nginx 作为反向代理
  • 我的域的 SSL,使用 Nginx 配置(也将 http 重定向到 https)
  • 另一个托管(!)与 Wordpress 博客那里
  • DNS 设置为 DigitalOcean VPS 和 Meteor 应用程序的 dom.in 文件在那里

如何将 doma.in/blog “重写”到博客,但使用相同的 URL? (没有重定向)。

【问题讨论】:

  • 不太确定您要在这里做什么。您有一个在 doma.in/ (在 index.html 中)文件上运行的 Angular 应用程序,以及在 doma.in/blog 上运行的博客,并且您希望来自 Angular 应用程序的链接在 doma.in/blog 上登陆wordpress页面而不是角度的子路由?或者你只是想让登陆 doma.in/blog 的人看到 wordpress 博客,尽管 wordpress 博客有不同的 url?

标签: angularjs ssl nginx path dns


【解决方案1】:

试试这个 nginx 配置:

location  ^/blog {
  rewrite /blog(.*) $1  break; #cut the /blog path
  proxy_pass         http://blog.com:8000; #then pass it to the blog domain/port
  proxy_redirect     off;  #without redirecting 
  proxy_buffering off;    #or buffering
}

至于角度,它只需要避免/跳过路线,正如在 SO 上讨论的here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-30
    • 1970-01-01
    • 2021-03-05
    • 1970-01-01
    • 1970-01-01
    • 2018-09-12
    相关资源
    最近更新 更多