title: How do I map a location to an upstream server in Nginx?
body: <p>I've got several Docker containers acting as web servers on a bridge network. I want to use Nginx as a proxy that exposes a service (web) outside the bridge network and embeds content from other services (i.e. wiki) using server side includes.</p>
  
  <p>Long story short, I'm trying to use the configuration below, but my locations aren't working properly. The <strong>/</strong> location works fine, but when I add another location (e.g. <strong>/wiki</strong>) or change <strong>/</strong> to something more specific (e.g. <strong>/web</strong>) I get a message from Nginx saying that it "Can't get /wiki" or "Can't get /web" respectively:</p>
  
  <pre><code>events { 
      worker_connections 1024; 
  }
  
  http {
      upstream wiki {
          server wiki:3000;
      }
  
      upstream web {
          server web:3000;
      }
  
      server {
          ssi on;
  
          location = /wiki {
              proxy_pass http://wiki;
          }
  
          location = / {
              proxy_pass http://web;
          }
      }    
  }
  </code></pre>
  
  <p>I've attached to the Nginx container and validated that I can reach the other containers using CURL- they appear to be working properly.</p>
  
  <p>I've also read the Nginx pitfalls and know that using hostnames (wiki, web) isn't ideal, but I don't know the IP addresses ahead of time and have tried to counter any DNS issues by telling docker-compose that the nginx container depends on web and wiki.</p>
  
  <p>Any ideas?</p>