Reverse proxy for multiple domains
francis at daoine.org
Sun Aug 20 20:08:37 UTC 2017
On Fri, Aug 18, 2017 at 07:01:26AM +0000, Mik J via nginx wrote:
> What would you do if you had ?
> CLIENT <-> INTERNET <->Reverse_Proxy<->Web_Server
That is the normal case, is it not? So just "use nginx as normal".
> On de web server I just use one default virtual host with multiple
I think that if you configure your "back-end" server that way, you are
more likely to have problems reverse proxying than if you configure
"one virtual host = one application".
If you want to reverse-proxy an application installed at one part of its
local url hierarchy, so that it looks like it is installed at another
part of the url hierarchy, then it is your job to make sure that any
part of the content returned that the client browser might interpret as
a url on this server, is correctly relative to the "another part". (It
presumably is by default relative to the "one part".)
Unless the application was written with a config option to make that
job trivial, I think it is easier to have the "public" url and "private"
url be the same.
On your system, you can configure it however you want to.
> Thats because the pages are called by the reverse proxy server
> like http://10.1.1.10:80/app/application1/; and it can't use a FQDN
> because it's in a private adressing
I don't follow that last part.
It can use a hostname if you want it to use a hostname.
I expect that it will be easier for you if you use a hostname, or if
you use two services listening on different ports.
> Is there a way that the reverse proxy connects to 10.1.1.10 but pretend
> the GET/POST queries use application1.org ?
If you can describe the http request that you want the client to make
to nginx; and describe the matching http request that you want nginx to
make to the back-end, it may be clearer what you mean.
> I'd prefer my application would be accessible by www.application1.org than
> www.application1.org/app/application1 like right now
>From the config you have shown, nginx makes the application available
at www.application1.org. It looks to me like it is the back-end which
causes it to appear at www.application1.org/app/application1.
Possibly you should remove "proxy_redirect off;", and remove the
"proxy_set_header Host $http_host;" line.
Good luck with it,
Francis Daly francis at daoine.org
More information about the nginx