nginx proxy_pass configuration to virtualhost

Francis Daly francis at daoine.org
Sun Dec 21 19:43:24 UTC 2014


On Sat, Dec 20, 2014 at 11:36:24PM +0100, Tim Spencer | Spacesharing GmbH wrote:

Hi there,

> I would like to redirect to an external URL which is hosted as a
> apache virtual host.

There may be subtleties about your configuration that have not been
included; but I'm not seeing any obvious reason why just changing one
line should not cause it all to work for you...

>             location / {
>                     proxy_set_header Host $host;

Change that to be

  proxy_set_header Host www.urlforvirtualhost.com;

and test again.

>                     proxy_pass http://www.urlforvirtualhost.com;
>             }

> The question is how do I allow proxy_pass without nginx resolving
> the ip-address of the host?

That question is not very clear to me, I'm afraid.

If the above change is insufficient (and it does include assumptions
such as: you will know when the IP address of the upstream
www.urlforvirtualhost.com changes and will restart nginx then), then it
may be helpful for you to describe what you want to happen, in terms of
what machine makes what request to what other machine.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list