title: How to configure nginx.conf so that I can use nginx as proxy to visit other sites?
body: <p>I'm doing it this way but always get 404 page:</p>
  
  <pre><code>location / {
                  proxy_pass        http://localhost:81;
                  proxy_set_header  X-Real-IP  $remote_addr;
          }
  </code></pre>
  
  <p>Requested tried:</p>
  
  <pre><code>telnet localhost 81
  
  GET http://stackoverflow.com/ HTTP/1.1
  Host: stackoverflow.com
  User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.17) Gecko/20110420 AlexaToolbar/alxf-2.11 Firefox/3.6.17
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Language: zh-cn,zh;q=0.5
  Accept-Encoding: gzip,deflate
  Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
  Keep-Alive: 115
  Cookie: A=t;
  Cache-Control: max-age=0
  </code></pre>
  
  <p>Result got:</p>
  
  <pre><code>HTTP/1.1 404 Not Found
  Server: nginx/1.0.2
  Date: Tue, 24 May 2011 00:30:51 GMT
  Content-Type: text/html
  Content-Length: 168
  Connection: keep-alive
  
  &lt;html&gt;
  &lt;head&gt;&lt;title&gt;404 Not Found&lt;/title&gt;&lt;/head&gt;
  &lt;body bgcolor="white"&gt;
  &lt;center&gt;&lt;h1&gt;404 Not Found&lt;/h1&gt;&lt;/center&gt;
  &lt;hr&gt;&lt;center&gt;nginx/1.0.2&lt;/center&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>