Having trouble running nginx on EC2 instance

2019-02-27 02:44发布

问题:

I installed Nginx with phusion passenger, but I am having trouble accessing the server. I am using the default configuration file, yet I never get a response from the server when I try to visit the IP address in my browser. On my server I can do :

curl 127.0.0.1

To get a response, but visiting the IP address in the browser always times out. I made sure port 80 was open by executing sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT, but nothing changed. I am using Ubuntu.

回答1:

Possible error-sources:

  • You use the internal EC2 ip and not the public.
  • You don't have any security policies set and you are hitting the EC2 firewall.
  • iptables is not configured correctly, disable it until it works without.
  • Nginx does not listen on the correct port. Use the default config.