<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-cite-prefix">On 21/12/14 11:31, mex wrote:<br>
    </div>
    <blockquote
cite="mid:e8e4d6c2817c7aafe72c20bb892ac3e7.NginxMailingListEnglish@forum.nginx.org"
      type="cite">
      <pre wrap="">Hi tim, 

</pre>
      <blockquote type="cite">
        <pre wrap="">Hi,

I would like to redirect to an external URL which is hosted as a
apache 
virtual host.
</pre>
      </blockquote>
      <pre wrap="">
redirect or proxy_pass? correct wording is important here

</pre>
    </blockquote>
    preferred proxy_pass<br>
    <br>
    <blockquote
cite="mid:e8e4d6c2817c7aafe72c20bb892ac3e7.NginxMailingListEnglish@forum.nginx.org"
      type="cite">
      <pre wrap="">
</pre>
      <blockquote type="cite">
        <pre wrap="">nginx resolves the host of the url which obviously does little to 
resolve to the correct web root on the server.
</pre>
      </blockquote>
      <pre wrap="">
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. 
</pre>
    </blockquote>
    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 <br>
    <blockquote
cite="mid:e8e4d6c2817c7aafe72c20bb892ac3e7.NginxMailingListEnglish@forum.nginx.org"
      type="cite">
      <pre wrap="">

</pre>
      <blockquote type="cite">
        <pre wrap="">
|  server {
             server_name localhost;
             location / {
                     proxy_set_header Host $host;
                     proxy_pass <a class="moz-txt-link-freetext" href="http://www.urlforvirtualhost.com">http://www.urlforvirtualhost.com</a>;
             }
     }
|

The question is how do I allow proxy_pass without nginx resolving the 
ip-address of the host?
</pre>
      </blockquote>
      <pre wrap="">
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
</pre>
    </blockquote>
    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.<br>
    <br>
    this would probably mean proxy_pass to a host configured to serve
    multiple pages as following <br>
    <br>
    <div dir="ltr" class="mw-geshi" style="text-align: left;">
      <div class="nginx source-nginx">
        <pre class="de1"><a href="http://wiki.nginx.org/NginxHttpCoreModule#http"><span class="kw3">http</span></a> <span class="br0">{</span>
  <a href="http://wiki.nginx.org/NginxHttpCoreModule#index"><span class="kw3">index</span></a> <a href="http://wiki.nginx.org/NginxHttpCoreModule#index"><span class="kw3">index</span></a>.html<span class="sy0">;</span>
 
  <a href="http://wiki.nginx.org/NginxHttpCoreModule#server"><span class="kw3">server</span></a> <span class="br0">{</span>
    <a href="http://wiki.nginx.org/NginxHttpCoreModule#server_name"><span class="kw3">server_name</span></a> <a class="moz-txt-link-abbreviated" href="http://www.domain1.com">www.domain1.com</a><span class="sy0">;</span>
    <a href="http://wiki.nginx.org/NginxHttpLogModule#access_log"><span class="kw18">access_log</span></a> logs/domain1.access.log main<span class="sy0">;</span>
 
    <a href="http://wiki.nginx.org/NginxHttpCoreModule#root"><span class="kw3">root</span></a> /var/www/domain1.com/htdocs<span class="sy0">;</span>
  <span class="br0">}</span>
 
  <a href="http://wiki.nginx.org/NginxHttpCoreModule#server"><span class="kw3">server</span></a> <span class="br0">{</span>
    <a href="http://wiki.nginx.org/NginxHttpCoreModule#server_name"><span class="kw3">server_name</span></a> <a class="moz-txt-link-abbreviated" href="http://www.domain2.com">www.domain2.com</a><span class="sy0">;</span>
    <a href="http://wiki.nginx.org/NginxHttpLogModule#access_log"><span class="kw18">access_log</span></a>  logs/domain2.access.log main<span class="sy0">;</span>
 
    <a href="http://wiki.nginx.org/NginxHttpCoreModule#root"><span class="kw3">root</span></a> /var/www/domain2.com/htdocs<span class="sy0">;</span>
  <span class="br0">}</span>
<span class="br0">}

<font face="sans-serif">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.</font>
</span></pre>
      </div>
    </div>
    <br>
    <blockquote
cite="mid:e8e4d6c2817c7aafe72c20bb892ac3e7.NginxMailingListEnglish@forum.nginx.org"
      type="cite">
      <pre wrap="">


cheers, mex

Posted at Nginx Forum: <a class="moz-txt-link-freetext" href="http://forum.nginx.org/read.php?2,255696,255704#msg-255704">http://forum.nginx.org/read.php?2,255696,255704#msg-255704</a>

_______________________________________________
nginx mailing list
<a class="moz-txt-link-abbreviated" href="mailto:nginx@nginx.org">nginx@nginx.org</a>
<a class="moz-txt-link-freetext" href="http://mailman.nginx.org/mailman/listinfo/nginx">http://mailman.nginx.org/mailman/listinfo/nginx</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>