title: Simple reverse proxy with Nginx (equivalent to Apache)
body: <p>With Apache, I can make reverse proxy working with this VirtualHost configuration.
  I have executed <code>nanoc view -p 8080</code>to use 8080 port for nanoc web app. </p>
  
  <p>With this setup, <code>http://scalatra.prosseek</code> is mapped to the nanoc. </p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ProxyPreserveHost On
      ServerName scalatra.prosseek
      ProxyPass  /excluded !
      ProxyPass / http://127.0.0.1:8080/
      ProxyPassReverse / http://127.0.0.1:8080/
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I need to have the same setup with Nginx, with some trial and error, I could make it work with this configuration. </p>
  
  <pre><code>upstream aha { # ??? (1)
          server 127.0.0.1:8080;
          keepalive 8;
  }
  
  # the nginx server instance
  server {
          listen 0.0.0.0:80;
          server_name scalatra.prosseek;
          access_log /usr/local/etc/nginx/logs/error_prosseek.log;
  
          location / {
              # ??? (2) 
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header Host $http_host;
              proxy_set_header X-NginX-Proxy true;
  
              proxy_pass http://aha/; # ??? (1)
              proxy_redirect off; # ??? (3)
          }
  }
  </code></pre>
  
  <p>It works, but I'm not sure if this is the best setup.
  Here come my questions:</p>
  
  <ul>
  <li>Is the setup OK for <code>http://scalatra.prosseek</code> to localhost:8080:
  
  <ul>
  <li>Are these correct setup of proxy_set_headers? Or did I miss something?</li>
  <li>For the proxy_pass and upstream, is it just OK as long as two names are the same?</li>
  <li>Do I need <code>proxy_redirect off;</code>?</li>
  </ul></li>
  </ul>