[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:

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

 

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

 

 

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

 

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

 

posted @ 2018-12-16 06:41  Grandyang  阅读(1558)  评论(0编辑  收藏  举报
Fork me on GitHub