首页 文章

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

提问于
浏览
4

我有:

  • DigitalOcean VPS

  • 在Angular中使用路由的Meteor应用程序

  • Nginx作为反向代理

  • 我的域的SSL,配置了Nginx(也将http重定向到https)

  • 另一个托管(!)与Wordpress博客那里

  • doma.in与DNS设置为DigitalOcean VPS和Meteor应用程序在那里

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

1 回答

  • 2

    试试这个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

相关问题