title: elastic beanstalk weird nginx configuration
body: <p>I am trying to follow the configuration of nginx on elastic beanstalk and some things do not add up.</p>
  
  <ul>
  <li><p>The instance is opening port 80 in the security groups, so I assume all incoming traffic is coming through that port</p></li>
  <li><p>The nginx configuration in cat /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf states:</p>
  
  <pre><code>server {
   listen 8080;
   location / {
      proxy_pass  http://nodejs;
      proxy_set_header   Connection "";
      proxy_http_version 1.1;
      proxy_set_header        Host            $host;
      proxy_set_header        X-Real-IP       $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
   }
   gzip on;
  }
  </code></pre>
  
  <p>Port 8080? Where did that come from? I've tried to mess with it, this is the actual directive that is working.</p></li>
  <li><p>server_name is missing, yet tt doesn't matter what you put in it. If I put any value in server_name myself, this server rule will still match all requests, even the ones that are not remotely reseble the server_name value.</p></li>
  <li><p>While connected to the instance itself it seems both ports are being served:</p>
  
  <p>[ec2-user@ip-172-31-45-222 ~]$ sudo netstat -lnptu</p>
  
  <p>tcp        0      0 0.0.0.0:8080               0.0.0.0:*                LISTEN      22506/nginx</p>
  
  <p>tcp        0      0 0.0.0.0:80                  0.0.0.0:*               LISTEN      22506/nginx</p></li>
  </ul>
  
  <p>Yet again, 8080 is never opened in the security group, so elastic load balanced is getting inside through port 80. Does traffic magically goes from 80 to 8080? Any ideas what is going on here?</p>