title: How to configure NGINX Location for Multiple Service
body: <p>I want to configure NGINX to work as a reverse proxy to other Microservices.</p>
  
  <p>I am able to forward the request from NGINX to one of the microservice</p>
  
  <p>if I do <code>curl http://xx.xx.xx.xx:8080/</code> call did landed on <strong>consumer-portal</strong> But 
  its using default location configuration <code>/</code></p>
  
  <p>when I comment the <code>1st</code> block and configure the same <code>code</code> for location <code>/consumer-portal</code> and do <code>curl http://xx.xx.xx.xx:8080/consumer-portal</code>   </p>
  
  <p>I get :</p>
  
  <blockquote>
    <p>Cannot GET /consumer-portal</p>
  </blockquote>
  
  <p>I have more than 10 microservice which I want to call using NGINX. </p>
  
  <p>Below is my <code>nginx.conf</code> file </p>
  
  <pre><code>worker_processes 4;
  events { 
          worker_connections 1024; 
      }
  
  http {
      sendfile on;
      upstream consumer-portal {
  
           server xx.xx.xx.xx:9006;
  
      }
      upstream publisher-portal {
  
           server xx.xx.xx.xx:9001;
      }
      server {
          listen 8080;
  
          #1st Block
          #location / {
          #    proxy_pass         http://consumer-portal;
          #    proxy_redirect     off;
          #    proxy_set_header   Host $host;
          #    proxy_set_header   X-Real-IP $remote_addr;
          #    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
          #    proxy_set_header   X-Forwarded-Host $server_name;
          #}
  
          #2nd Block
          location  /consumer-portal {
              proxy_pass         http://consumer-portal;
              proxy_redirect     off;
              proxy_set_header   Host $host;
              proxy_set_header   X-Real-IP $remote_addr;
              proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header   X-Forwarded-Host $server_name;
          }
  
          #3rd Block
          location /publisher-portal/ {
               proxy_pass         http://publisher-portal;
               proxy_redirect     off;
               proxy_set_header   Host $host;
               proxy_set_header   X-Real-IP $remote_addr;
               proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
               proxy_set_header   X-Forwarded-Host $server_name;
           }
  }
  }
  </code></pre>
  
  <p>Also, Please let me know If I can forward the request using docker container name.</p>
  
  <p>e.g instead of server <code>xx.xx.xx.xx:9006</code> i want to use <code>server consumer-portal:9006</code> </p>
  
  <p>Please suggest what changes I need to do into <strong>.conf</strong> file.</p>