在AWS上运行nginx会发回“ERR_CONNECTION_TIMED_OUT”响应

我已经在Ubuntu AWS(EC2)节点上安装了nginx,并确认它正在通过ps -aef | grep nginx运行 ps -aef | grep nginx 。 在server部分我有:

 server { listen 8080; server_name ec2-<blah>.us-west-2.compute.amazonaws.com; location / { root /opt/derp; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } 

…其中ec2-<blah>.us-west-2.compute.amazonaws.com是我的EC2实例的公共DNS。

当我重新加载( sudo nginx -s reload )并转到http://ec2-<blah>.us-west-2.compute.amazonaws.com:8080 ,我希望得到默认的nginx“ Welcome! ”页面,但相反,我得到HTTP失败(在Chrome net::ERR_CONNECTION_TIMED_OUT ,这是我得到的最多的信息)。

对我来说,这可能是因为:

  1. 也许我会去错误的URL(我的结尾用户错误)
  2. 也许有一些networkingconfiguration(防火墙规则等),我需要在AWS中设置
  3. 也许是一个nginxconfiguration问题
  4. 也许一个Linux用户/权限问题

我在这里排除(或确认)一个nginx问题。 任何人都可以发现我的nginx serverconfiguration有什么问题吗? 我可以高兴地发布我的nginx.conf其他部分,或提供任何其他的细节,审查nginx作为一个潜在的问题孩子或不。

为允许入站tcp 8080的实例configuration一个安全组。同时确保实例上的本地防火墙(iptables,ufw,firewalld或类似的)不阻止通信。