nginx proxy_pass configuration to virtualhost

Tim Spencer | Spacesharing GmbH t.spencer at
Sun Dec 21 13:10:18 UTC 2014

On 21/12/14 11:31, mex wrote:
> Hi tim,
>> Hi,
>> I would like to redirect to an external URL which is hosted as a
>> apache
>> virtual host.
> redirect or proxy_pass? correct wording is important here
preferred proxy_pass

>> nginx resolves the host of the url which obviously does little to
>> resolve to the correct web root on the server.
> i dont understand what you mean here. if nginx doesnt resolve a dns-name
> how should it know how to deal with it? dns-names are for humans.
yeah the issue does not seem to be on my side, I have have no issue of 
nginx resolving the ip but it seems that the hosting company I would 
like to proxy_pass to has the virtual hosts configured on the dns names
>> |  server {
>>               server_name localhost;
>>               location / {
>>                       proxy_set_header Host $host;
>>                       proxy_pass;
>>               }
>>       }
>> |
>> The question is how do I allow proxy_pass without nginx resolving the
>> ip-address of the host?
> but why dont you want nginx to resolve the IP?
> i'm not sure this will  work as expected, except you put in the ip.
> but then the apache on the other side should be configred
> with the ip in the virtualhost
generally I concur but how would they be able to, in est multiple sites 
on the same public ip but differentiate on dns names (this is also 
achievable on nginx) with the default directing to nowhere.

this would probably mean proxy_pass to a host configured to serve 
multiple pages as following

http  <>  {
   index  <>  index  <>.html;
   server  <>  {
     server_name  <>;
     access_log  <>  logs/domain1.access.log main;
     root  <>  /var/www/;
   server  <>  {
     server_name  <>;
     access_log  <>   logs/domain2.access.log main;
     root  <>  /var/www/;

would not work. I presumed there was a option to force nginx to not resolve but I can see now this is probably not the case and I would need to change to redirect instead of proxy_pass.

> cheers, mex
> Posted at Nginx Forum:,255696,255704#msg-255704
> _______________________________________________
> nginx mailing list
> nginx at

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

More information about the nginx mailing list