简体   繁体   English

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

[英]Meteor, Angular routes, Nginx and SSL - how to route /path to another server with rewrite

I have: 我有:

  • DigitalOcean VPS DigitalOcean VPS
  • Meteor application with routing in Angular 在Angular中使用路由的流星应用程序
  • Nginx as a reverse-proxy Nginx作为反向代理
  • SSL for my domain, configured with Nginx (also redirecting http to https) 我的域的SSL,配置了Nginx(也将http重定向到https)
  • another hosting (!) with Wordpress blog there 另一个托管(!)与Wordpress博客那里
  • something doma.in with DNS set to DigitalOcean VPS and Meteor app is there 一些doma.in与DNS设置为DigitalOcean VPS和Meteor应用程序就在那里

How can I "rewrite" doma.in/blog to the blog, but with this same URL? 如何“重写”doma.in/blog到博客,但使用相同的URL? (without redirect). (没有重定向)。

Try this nginx configuration: 试试这个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
}

As for angular, it simply needs to avoid/skip the route, as discussed here on SO 至于角度,它仅仅需要避免/跳过路线,如所讨论这里对SO

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM