NGINX Amazon EC2一直在加载,但没有显示任何内容

NGINX Amazon EC2一直在加载,但没有显示任何内容,nginx,amazon-ec2,Nginx,Amazon Ec2,我对设置生产机器有点陌生,我不明白为什么在我的EC2机器上看不到nginx的默认索引页。它安装并运行在我的服务器上,但当我尝试访问时,它会一直加载,什么也不显示,一直显示在空白页上。我正在尝试通过公共ip 35.160.22.104和公共dnsec2-35-160-22-104.us-west-2.compute.amazonaws.com访问。两者的作用相同。我做错了什么 更新: 我意识到当重新启动nginx服务时,它没有显示ok消息。所以我看了一下error.log: [ 2016-12-1

我对设置生产机器有点陌生,我不明白为什么在我的EC2机器上看不到nginx的默认索引页。它安装并运行在我的服务器上,但当我尝试访问时,它会一直加载,什么也不显示,一直显示在空白页上。我正在尝试通过公共ip 35.160.22.104和公共dnsec2-35-160-22-104.us-west-2.compute.amazonaws.com访问。两者的作用相同。我做错了什么

更新: 我意识到当重新启动nginx服务时,它没有显示ok消息。所以我看了一下error.log:

[ 2016-12-12 17:16:11.2439 709/7f3eebc93780 age/Cor/CoreMain.cpp:967 ]: Passenger core shutdown finished
2016/12/12 17:16:12 [info] 782#782: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:71
[ 2016-12-12 17:16:12.2742 791/7fb0c37a0780 age/Wat/WatchdogMain.cpp:1291 ]: Starting Passenger watchdog...
[ 2016-12-12 17:16:12.2820 794/7fe4d238b780 age/Cor/CoreMain.cpp:982 ]: Starting Passenger core...
[ 2016-12-12 17:16:12.2820 794/7fe4d238b780 age/Cor/CoreMain.cpp:235 ]: Passenger core running in multi-application mode.
[ 2016-12-12 17:16:12.2832 794/7fe4d238b780 age/Cor/CoreMain.cpp:732 ]: Passenger core online, PID 794
[ 2016-12-12 17:16:12.2911 799/7f06bb50a780 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter...
[ 2016-12-12 17:16:12.2916 799/7f06bb50a780 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 799
无论如何,它看起来不像是一个错误,而是一个普通的日志

更新2: Nginx正在运行:

root       810     1  0 17:16 ?        00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data   815   810  0 17:16 ?        00:00:00 nginx: worker process
ubuntu     853 32300  0 17:44 pts/0    00:00:00 grep --color=auto nginx
当我尝试执行curl localhost时,它会按预期返回HTML

更新3:

运行systemctl status nginx时,出现以下错误:

Dec 12 17:54:48 ip-172-31-40-156 systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
想弄清楚是什么

更新4: 运行命令nmap 35.160.22.104-Pn PORT STATE SERVICE 22/tcpand并获得输出:

Starting Nmap 7.01 ( https://nmap.org ) at 2016-12-12 18:05 UTC
Failed to resolve "PORT".
Failed to resolve "STATE".
Failed to resolve "SERVICE".
Unable to split netmask from target expression: "22/tcp"
Nmap scan report for ec2-35-160-22-104.us-west-2.compute.amazonaws.com (35.160.22.104)
Host is up (0.0015s latency).
Not shown: 999 filtered ports
PORT   STATE SERVICE
22/tcp open  ssh
更新5:

netstat-tuanp | grep 80的输出:


您的ec2实例有一个关联的安全组。 您应该转到AWS控制台EC2->Instances->单击您的实例->底部的“描述”-->安全组。单击名称,您将被重定向到EC2->Network and Security。单击“编辑入站规则”添加规则:

类型:HTTP
保存。那应该很好

空白页真的是白页吗?没有信吗?^^检查nginx错误日志。确认您有一个端口80打开的安全组与该实例关联。。提供更多细节@没错。它尝试加载一段时间,然后停止。没有错误,没有消息。我更新了这个问题,这样也许有助于理解它。谢谢!我不是乘客,但如果服务器响应$curl localhost,请确认nginx正在运行$ps-ef | grep nginx Check。您确认是否打开了具有正确端口的安全组了吗?@Tomahock再次用输出更新了问题。。。关于那个安全小组,我不太了解。我该如何检查呢?如果您要使用HTTPs,并且您应该将另一个规则添加到HTTPs中,作为AWS还提供了一个预先制定的规则的类型!哦,我在启动实例时就这么做了。。。但在nginx上发现了其他内容并更新了问题。非常感谢你的帮助!尝试用sudo运行该命令。如果nginx正在运行,您可以curl localhost它看起来确实是封闭端口:nmap 35.160.22.104-Pn port STATE SERVICE 22/tcp open ssh nmap done:1 IP地址1主机在13.19秒内扫描完毕如果您在服务器$curl 35.160.22.104上尝试,它会失败,对吗?我用nmap命令的输出错误更新了这个问题。对于curl,它只适用于localhost。对于公共IP,它一直在执行,不返回任何内容。。。与web浏览器一样,问题在于安全组。我在创建时为它添加了HTTP和SSH,但由于某种原因它消失了。很抱歉将问题扩大,非常感谢您的帮助!救了我的命=
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      -               
tcp6       0      0 :::80                   :::*                    LISTEN      -