title: nginx: no handler for server
body: <p>I am trying to configure nginx proxy for a tcp service, the http proxy stuff works as expected. However, I keep getting this error for the server inside the <code>stream</code> context.</p>
  
  <p><code>no handler for server in /etc/nginx/nginx.conf:6</code></p>
  
  <p>I don't understand how it's different from the servers defined in the <code>http</code> context.</p>
  
  <pre><code>events {
  
  }
  
  stream {
        server {
          listen 5601;
          deny   all;
      }
  }
  
  http {
  
      server {
          listen 80;
          server_name example.com;
          location / {
              proxy_set_header   X-Forwarded-For $remote_addr;
              proxy_set_header   Host $http_host;
              return 301 https://$host$request_uri;
          }
          location /.well-known/acme-challenge/ {
              root /var/www/certbot;
          }
      }
      server {
          listen 443 ssl;
          server_name example.com;
          ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
          ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
          include /etc/letsencrypt/options-ssl-nginx.conf;
          ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
  
          location / {
              proxy_pass http://example.com:5601;
          }
      }
  }
  </code></pre>
  
  <p>What does this error mean and how do I fix this?</p>