Use sub-url to identify the different server

Francis Daly francis at
Thu Jan 10 23:48:05 UTC 2019

On Thu, Jan 10, 2019 at 02:54:14AM -0500, nevereturn01 wrote:

Hi there,

> I have 2 internal web hosts & 1 dedicate Nginx as reverse proxy, eg
> &
> Now, I need to access the different hosts via sub-url. eg:
> 1. ----->
> ----->
> 2. ----->
> ----->

If you have the freedom to change the internal web hosts, such that
(for example) the content is all locally below the url
// instead of //, then you will probably find
it much easier to reverse-proxy them.

  location /site1 { proxy_pass; }
  location /site2 { proxy_pass; }

is possibly all you would need in that case.

If you can't do that, then the start of what you will need will be
more like

  location /site1/ { proxy_pass; }
  location /site2/ { proxy_pass; }

but you will have to take care that anything that is returned to the
client that will be interpreted as a url, will be interpreted the way
you want it to be. If the internal servers do not make that easy, it
will probably not be easy for you.

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list