Meteor, Angular, Nginx and SSL - how to route / path to another server with rewriting

I have:

  • DigitalOcean VPS
  • Meteor routing app in Angular
  • Nginx as a reverse proxy
  • SSL for my domain configured with Nginx (also redirecting http to https)
  • another hosting (!) with the Wordpress blog there
  • something doma.in with DNS set for DigitalOcean VPS and Meteor app is

How can I "rewrite" doma.in/blog to a blog, but with the same address? (without redirection).

+4
source share
1 answer

Try this nginx configuration:

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
}

angular, / , SO

+2

All Articles