Reverse proxy for multiple domains

Mik J mikydevel at
Fri Aug 18 07:01:26 UTC 2017

Thank you Francis for your answer
Actually is does this with a simple index.html page# cat index.htmlTEST
What would you do if you had ?
CLIENT <-> INTERNET <->Reverse_Proxy<->Web_ServerOn de web server I just use one default virtual host with multiple sections. Thats because the pages are called by the reverse proxy server like; and it can't use a FQDN because it's in a private adressing
Is there a way that the reverse proxy connects to but pretend the GET/POST queries use ?

I'd prefer my application would be accessible by than like right now


    Le Jeudi 17 août 2017 21h35, Francis Daly <francis at> a écrit :

 On Thu, Aug 10, 2017 at 09:17:14PM +0000, Mik J via nginx wrote:

Hi there,

> I have and
> The client requesting these URLs, arrives one the reverse proxy.
> On this reverse proxy I have a virtual host which looks like that
> server {
> server_name;
> location ^~ / {
> proxy_pass;
> }
> And another virtual host for application2 which is similar with
> proxy_pass;
> The server behind the reverse proxy is the same right now

> 1) Is it the right way to do this ?

I think that trying to reverse-proxy an application at a different part
of the url tree to where the app thinks it is installed, is difficult.

So if application1 believes that it is installed at /app/application1,
I would suggest to expose that to the world. (Or: if you want the world
to see it at /, then configure the internal server so that it is at /
there too.)

Then your external config is mostly just "proxy_pass;", possibly with "location = / { return 301
/application/app1/; }"

The *internal* config could probably have one server{} for each
application as well.

> 2) When I access the application from Internet using, I am redirected to I don't know why. And I have to add one more section on the reverse proxy

> Is there a better way to do it ?

I'm not sure why that extra section is necessary, unless the "..." part
of your config is important.

Francis Daly        francis at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list