Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我一直试图让 nginx 在我的 ec2 实例上启动。我所做的只是安装 nginx,并且似乎在服务器中按预期运行。
运行curl localhost按预期提供默认的 nginx 文件。导航到公共 IP,我只是得到一个站点无法访问错误(IP 拒绝连接)。
curl localhost
据我了解,入站规则也已正确设置。我没有更改 nginx 的任何配置文件,因为我只是想测试它是否正常工作。一切都保留为默认值。有人对为什么会发生这种情况有任何想法吗?太感谢了。
netstat -ntlp
问题是由我的防火墙规则阻止访问公共 IP 地址引起的。如果其他人出现此问题,请检查 IP 是否在连接到同一网络的另一台设备上工作。然后我刷新了我的 iptables 并重新启动了我的电脑,它开始工作了。