Question

Is it possible to configure Nginx + Phusion Passenger in such a way that all the paths in URL will lead to one application, but /specialpath - to the second application?

Était-ce utile?

La solution

Yes. Just follow the sub-URI deployment instructions in the Phusion Passenger Nginx manual: https://www.phusionpassenger.com/library/deploy/nginx/deploy/ruby/#deploying-an-app-to-a-sub-uri-or-subdirectory

Autres conseils

Of course it is.

You need to define two different upstreams, and direct traffic to them as follows:

upstreams railsapp1 {
  #ip and port of first rails app
  server 127.0.0.1:8001;
}
upstreams railsapp2 {
  #ip and port of second rails app
  server 127.0.0.1:8002;
}

server {
  server_name my.domain.com;
  location /special_path {
      proxy_pass http://railsapp2;
  }

  location / {
      proxy_pass http://railsapp1;
  }
}

Of course you need to make some changes to fit your configuration but this is the idea.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top