AWS Nginx Started but not Serving AWS上Nginx服务器无法正常工作

 

After install the Nginx on AWS instance, and visit your public ip address, you might see the following:

AWS Nginx Started but not Serving AWS上Nginx服务器无法正常工作

This site can't be reached

xxx.xxx.xx take too long to respond.

 

Try the following steps to solve:

Go to EC2 Dashboard -> NETWORK & SECURITY -> Security Groups 

Select your current group, and right click, choose Edit inbound rules:

Add two items:

HTTP - TCP - 80 - Custom - 0.0.0.0/0

HTTP - TCP - 80 - Custom - ::/0

AWS Nginx Started but not Serving AWS上Nginx服务器无法正常工作

 

Then try to visit the public ip address again, hopefully it works like this:

 

AWS Nginx Started but not Serving AWS上Nginx服务器无法正常工作

 

If you try to visit your subdomain, and see the following page:

 

AWS Nginx Started but not Serving AWS上Nginx服务器无法正常工作

An error occurred.

Sorry, the page you are looking for is currently unavailable.

Please try again later.

 

Then try use the following command to check the log:

grep "error_log" /etc/nginx/* -R
tail -n 100 /var/log/nginx/error.log

 

If you see the following error:

(13: Permission denied) while connecting to upstream:[nginx]

 

Try the following command to fix:

setsebool -P httpd_can_network_connect 1