title: Nginx status endpoint running inside Docker
body: <p>I'm new to Nginx, which I'm running in a Docker container to serve a simple website. I want to add an <code>/health</code> endpoint that simply returns status 200 + some arbitrary content.</p>
  
  <p>I copied and adjusted the standard <code>nginx.conf</code> from <code>/etc/nginx/</code> by adding </p>
  
  <pre><code>server {
      location /health {
          return 200 "alive";
      }
  }
  </code></pre>
  
  <p>at the bottom inside the <code>http</code> block. But when I run the Docker, and try to access <code>localhost/health</code>, I just get <code>no such file or directory</code>. Accessing the website at <code>localhost</code> works fine.</p>
  
  <p>I also tried copying other code blocks, e.g., this one: <a href="https://gist.github.com/dhrrgn/8650077" rel="noreferrer">https://gist.github.com/dhrrgn/8650077</a>
  But then I get <code>conflicting server name "" on 0.0.0.0:80, ignored nginx: [warn] conflicting server name "" on 0.0.0.0:80, ignored</code>.</p>
  
  <p>Am I placing the <code>location</code> at a wrong location inside <code>nginx.conf</code>? Do I need some special server configuration? What's the problem?</p>