title: nginx proxy_pass configuration
body: <p>I need to proxy a couple of urls to different hosts. Actually, I'm using the same host with different port to test my nginx configuration. This is my virtual host definition:</p>
  
  <pre><code>server {
      listen       8081;
      server_name  domain.com;
  
      location /Plasmid/ {
          proxy_pass   http://localhost:8000/Plasmid/;
      }
  
  
      location /_community/ {
           proxy_pass   http://localhost:8082/comments_api/ ;
      }
  
      location / {
          # rewrite cq_user_authenticated===(.*)/(.*)/iuuid=(.*)/commenti.html$  /Plasmid/comments/legacy/$3/$1 ;
          # rewrite querystring===(.*)$  /Plasmid/comments/legacy/$1 ;
          # rewrite cq_user_authenticated===([^&amp;]*)&amp;/.*uuid=([^/]*) /comments_api/legacy/$2 ;
          # rewrite userdetails(.*)  /Plasmid/comments/user_details ;
          root   html;
          index  index.html index.htm;
      }
  
  }
  </code></pre>
  
  <p>Of course my hosts file has mapping for the domain.com</p>
  
  <p>When I call the url: <a href="http://domain.com:8081/Plasmid/default/page/12" rel="nofollow">http://domain.com:8081/Plasmid/default/page/12</a> I get an http 404 </p>
  
  <p>If I remove the second location from my configuration:</p>
  
  <pre><code>location /_community/ {
      proxy_pass   http://localhost:8082/comments_api/ ;
  }
  </code></pre>
  
  <p>I get the resource I want, but some part are missed since the are hosted on a different platform: </p>
  
  <pre><code>[error] 1033#0: *1 open() "/usr/local/Cellar/nginx/1.2.6/html/_community/content
  </code></pre>
  
  <p>How can I resolve this issue?</p>