Meteor,Angular路由,Nginx和SSL-如何通过重写路由/路径到另一个服务器



我有:

  • DigitalOcean VPS
  • Angular路由的Meteor应用
  • Nginx作为反向代理
  • 我的域的SSL,使用Nginx配置(也将http重定向到https)
  • Wordpress博客的另一个主机(!)
  • DNS设置为DigitalOcean VPS和Meteor应用程序的doma.in

如何将doma.in/blog"重写"为博客,但使用相同的URL?(无重定向)。

试试这个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 上讨论的那样

最新更新