<div>Sorry later feedback because of the bussiness trip. </div>
<div> </div>
<div>I configured it according to Igor Sysoev&#39;s advice, but it failed. </div>
<div>I sniff in the webserver&#39;s side, I found the request message is stranger. </div>
<div>----------------------------------------------------------------<br>Case1:  Access from 192.168.2.169-&gt;192.168.10.169(web server) <strong>VIA</strong> NGINX reverse proxy. </div>
<p><font color="#ff0000">GET /<a href="http://abc.com">abc.com</a></font> HTTP/1.0<br><font color="#ff0000">Host: <a href="http://abc.com">abc.com</a></font><br>X-Real-IP: 192.168.2.169<br>X-Forwarded-For: 192.168.2.169<br>
<font color="#ff0000">Connection: close<br></font>Accept: */*<br>Accept-Language: zh-cn<br>Pragma: no-cache<br>If-Modified-Since: Sun, 11 Oct 2009 08:53:36 GMT<br>If-None-Match: &quot;c8752c52504aca1:2b3&quot;<br>User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)<br>
Proxy-Connection: Keep-Alive</p>
<p>HTTP/1.1 404 Not Found<br>Content-Length: 1308<br>Content-Type: text/html<br>Server: Microsoft-IIS/6.0<br>X-Powered-By: <a href="http://ASP.NET">ASP.NET</a><br>Date: Sun, 11 Oct 2009 09:19:44 GMT<br>Connection: close<br>
</p>
<div>----------------------------------------------------------------------------------------------------------<br>Case 2. Access from 192.168.2.169-&gt;192.168.10.169(web server) <strong>BYPASS</strong> the NGINX revers proxy </div>

<div> </div>
<div align="left"><font color="#ff0000">GET /</font> HTTP/1.1</div>
<div align="left">Accept: */*</div>
<div align="left">Accept-Language: zh-cn</div>
<div align="left">Accept-Encoding: gzip, deflate</div>
<div align="left">If-Modified-Since: Sun, 11 Oct 2009 08:53:36 GMT</div>
<div align="left">If-None-Match: &quot;c8752c52504aca1:2b3&quot;</div>
<div align="left">User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)</div>
<div align="left"><font color="#ff0000">Host: <a href="http://abc.com">abc.com</a></font></div>
<div align="left"><font color="#ff0000">Connection: Keep-Alive</font></div>
<div align="left"> </div>
<div align="left">HTTP/1.1 200 OK</div>
<div align="left">Content-Length: 248</div>
<div align="left">Content-Type: text/html</div>
<div align="left">Content-Location: <a href="http://abc.com/index.htm">http://abc.com/index.htm</a></div>
<div align="left">Last-Modified: Sun, 11 Oct 2009 08:53:36 GMT</div>
<div align="left">Accept-Ranges: bytes</div>
<div align="left">ETag: &quot;c8752c52504aca1:2c1&quot;</div>
<div align="left">Server: Microsoft-IIS/6.0</div>
<div align="left">X-Powered-By: <a href="http://ASP.NET">ASP.NET</a></div>
<div align="left">Date: Sun, 11 Oct 2009 09:19:34 GMT</div>
<div align="left"><span class="gmail_quote">-----------------------------------------------------------------------------------------------------</span></div>
<div align="left"><span class="gmail_quote">The case 1 is failed. If I bypass the NGINX revers-proxy, it success. </span></div>
<div align="left"><span class="gmail_quote">I marked with RED, there are some difference. I can not dig into deep. </span></div>
<div align="left"><span class="gmail_quote">please help me for the issue. </span></div>
<div align="left"><span class="gmail_quote"></span> </div>
<div align="left"><span class="gmail_quote">I pasted the configuration as following: </span></div>
<div align="left"><span class="gmail_quote">-------------------------------------------------------------------------------</span></div>
<div align="left"><span class="gmail_quote"> 47   server {<br> 48       listen 8080;<br> 49       server_name <a href="http://abc.com">abc.com</a>;<br> 50       access_log /var/log/nginx/access.log;<br> 51 <br> 52       location / {<br>
 53           proxy_pass <a href="http://192.168.10.169/abc.com">http://192.168.10.169/abc.com</a>;<br> 54           proxy_redirect default;<br> 55           proxy_set_header Host $host;<br> 56           proxy_set_header  X-Real-IP  $remote_addr;<br>
 57           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br> 58           client_max_body_size 50m;<br> 59           client_body_buffer_size 256k;<br> 60      }<br> 61  }<br> 62  server {<br> 63       listen 8080;<br>
 64       server_name <a href="http://def.com">def.com</a>;<br> 65       access_log /var/log/nginx/access.log;<br> 66 <br> 67       location / {<br> 68           proxy_pass <a href="http://192.168.10.169/def.com">http://192.168.10.169/def.com</a>;<br>
 69           proxy_redirect default;<br> 70           proxy_set_header Host $host;<br> 71           proxy_set_header  X-Real-IP  $remote_addr;<br> 72           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>
 73           client_max_body_size 50m;<br> 74           client_body_buffer_size 256k;<br> 75     }<br> 76  }</span></div>
<div align="left"><span class="gmail_quote"></span> </div>
<div align="left"><span class="gmail_quote"></span> </div>
<div align="left"><span class="gmail_quote">thanks </span></div>
<div align="left"><span class="gmail_quote">NextHop </span></div>
<div align="left"><span class="gmail_quote"></span> </div>
<div align="left"><span class="gmail_quote"></span> </div>
<div align="left"><span class="gmail_quote"></span> </div>
<div align="left"><span class="gmail_quote"></span> </div>
<div align="left"><span class="gmail_quote">On 10/6/09, <b class="gmail_sendername">Igor Sysoev</b> &lt;<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>&gt; wrote:</span></div>
<div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">On Mon, Oct 05, 2009 at 04:00:23PM +0800, quan nexthop wrote:<br><br>&gt; Hi all:<br>&gt;<br>&gt; I try to setup the NGINX as a reverse-proxy to protect several webservers,<br>
&gt; which lots of websites are running on. Yes, it is a virtual host :)<br>&gt;<br>&gt; <a href="http://abc.com">abc.com</a> |-----------[nginx reverse proxy] ------- |virtualhost] ----/abc<br>&gt; directory<br>&gt; <a href="http://123.com">123.com</a>|<br>
&gt; |--/123  directory<br>&gt;<br>&gt; [note] the virtualhost port is 80.<br>&gt;<br>&gt; I go through the <a href="http://wiki.nginx.net">wiki.nginx.net</a> and can not find any configuration related<br>&gt; with the topology.<br>
&gt;<br>&gt; Any one can paste a configuration for such case?<br>&gt; how can I distinguish the different server in one listening port?<br><br>Probably you need<br><br>   server {<br>       server_name  <a href="http://abc.com">abc.com</a>;<br>
       location / {<br>           proxy_pass  <a href="http://123.com/abc/">http://123.com/abc/</a>;<br>       }<br>   }<br><br>   server {<br>       server_name  <a href="http://def.com">def.com</a>;<br>       location / {<br>
           proxy_pass  <a href="http://123.com/def/">http://123.com/def/</a>;<br>       }<br>   }<br><br><br>--<br>Igor Sysoev<br><a href="http://sysoev.ru/en/">http://sysoev.ru/en/</a><br><br></blockquote></div><br>