Nginx reverse proxy multi upstream (multiples sites)

Francis Daly francis at daoine.org
Sat Apr 11 07:25:31 UTC 2015


On Fri, Apr 10, 2015 at 06:29:38PM -0400, cloud devops wrote:

Hi there,

> Yes "market.cloud.com" and  "panel.cloud.com" resolve to the nginx server.

> My issue is to point the nginx server to many backend server, the nginx
> requires to have different location which cause probleme to navigate in the
> different backen server. Is there a solution to work with nginx as a reverse
> proxy for many backend servers (differents sites)

nginx needs some way of knowing which backend server to use, for each
individual request.

The simplest is probably just to use the host in the request:

==
  server {
    server_name market.cloud.com;
    location / {
      proxy_pass http://market.cloud.com;
    }
  }
  server {
    server_name panel.cloud.com;
    location / {
      proxy_pass http://panel.cloud.com;
    }
  }
==

If that is not appropriate, then the next most straightforward is probably
to change the backend servers so that all of the content on 10.1.0.12 is
available below "/panel/", and all of the content on 10.1.0.16 is below
"/market/" (or some other unique prefix) and use *that* as the way that
nginx can decide which backend to use.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list