title: Setup nginx not to crash if host in upstream is not found
body: <p>We have several rails apps under common domain in Docker, and we use nginx to direct requests to specific apps.</p>
  
  <pre><code>our_dev_server.com/foo # proxies to foo app
  our_dev_server.com/bar # proxies to bar
  </code></pre>
  
  <p>Config looks like this:</p>
  
  <pre><code>upstream foo {
    server foo:3000;
  }
  
  upstream bar {
    server bar:3000;
  }
  
  # and about 10 more...
  
  server {
    listen *:80 default_server;
  
    server_name our_dev_server.com;
  
    location /foo {
        # this is specific to asset management in rails dev
        rewrite ^/foo/assets(/.*)$ /assets/$1 break;
        rewrite ^/foo(/.*)$ /foo/$1 break;
        proxy_pass http://foo;
    }
  
    location /bar {
        rewrite ^/bar/assets(/.*)$ /assets/$1 break;
        rewrite ^/bar(/.*)$ /bar/$1 break;
        proxy_pass http://bar;
    }
  
    # and about 10 more...
  }
  </code></pre>
  
  <p>If one of these apps is not started then nginx fails and stops:</p>
  
  <pre><code>host not found in upstream "bar:3000" in /etc/nginx/conf.d/nginx.conf:6
  </code></pre>
  
  <p>We don't need them all to be up but nginx fails otherwise.
  How to make nginx ignore failed upstreams?</p>