title: Nginx : Second location block is redirecting to path of first location block
body: <p>Here is the code I am using, I referred to tutorial given at <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04" rel="nofollow noreferrer">Digital Ocean</a>. As you can see there are two location block inside a server block but on entering the path name.com/app it is redirecting to name.com, there are two apps on my server first is running on port 3000 and another on 3001, when I am changing 3001 to any port, surprisingly instead of redirection, it gives error bad gateway ( as there is nothing on that port ).</p>
  
  <pre><code>server{
          listen 443 ssl;
  
          server_name name.com www.name.com;
  
          ssl_certificate /etc/letsencrypt/live/name.com/fullchain.pem;
          ssl_certificate_key /etc/letsencrypt/live/name.com/privkey.pem;
  
          location / {
                  proxy_pass http://localhost:3000;
                  proxy_http_version 1.1;
                  proxy_set_header Upgrade $http_upgrade;
                  proxy_set_header Connection 'upgrade';
                  proxy_set_header Host $host;
                  proxy_cache_bypass $http_upgrade;
          }
  
          location /app {
                  proxy_pass http://localhost:3001;
                  proxy_http_version 1.1;
                  proxy_set_header Upgrade $http_upgrade;
                  proxy_set_header Connection 'upgrade';
                  proxy_set_header Host $host;
                  proxy_cache_bypass $http_upgrade;
          }
  
          ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
          ssl_prefer_server_ciphers on;
          ssl_dhparam /etc/ssl/certs/dhparam.pem;
          ssl_ciphers '**STRING**$
          ssl_session_timeout 1d;
          ssl_session_cache shared:SSL:50m;
          ssl_stapling on;
          ssl_stapling_verify on;
          add_header Strict-Transport-Security max-age=15768000;
  }
  </code></pre>