I currently have the following settings on the default security group which my instance is a part of.
However, I can't browse the site. The response from the browser(Firefox) is "Firefox can't establish a connection to the server at ec2-50-16-10-32.compute-1.amazonaws.com."
Update#1:
No output from netstat -pant | grep :80
Output from iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Update#2:
Output of ps -ef | grep nginx
root 1080 1 0 01:22 ? 00:00:00 nginx: master process /opt/nginx/sbin/nginx
nobody 1082 1080 0 01:22 ? 00:00:00 nginx: worker process
nobody 1083 1080 0 01:22 ? 00:00:01 nginx: worker process
nobody 1084 1080 0 01:22 ? 00:00:01 nginx: worker process
nobody 1085 1080 0 01:22 ? 00:00:01 nginx: worker process
ubuntu 4001 3983 0 18:57 pts/1 00:00:00 grep --color=auto nginx
root 2601 842 0 06:52 pts/0 00:00:00 grep nginx
No output for netstat -pant | grep nginx
Best Answer
The "can't connect" error can usually be taken quite literally - the browser is unable to establish a connection to the remote server. This typically comes down to one of two reasons:
You either need to prove that something is happening, or disprove all the other options.
Firewall:
Server issue:
If you have connectivity from your computer to the server (e.g. can SSH into the computer, and have no firewall issues) - then you need to check for a server that is listening for incoming connections and able to respond to them.
Check that your web server is running (in the case of nginx):
Once you have established that your server is in fact running, you need to verify that it is listening on the correct port. While the server will typically display an error and not start if the port it tries to bind to is in use, if it simply uses an uncommon port (or ipv6 only), the problem may not be obvious. Another common problem is to have the web server listening on the loopback interface only instead of either all interfaces or the public interface.
Check what, if anything, is listening on port 80 with:
If you have reason to doubt netstat (or simply want to try a different approach), you will get similar information from:
if you see no entries then nothing is listening on port 80
You can also check if Nginx is listening on ports other than 80 by using:
Should you find yourself in the unusual scenario where nginx is running, but not listening on any port, there is a good chance that there is a problem with your config. In particular, Nginx will only bind a listener when a
server{}
block is present - if you have noserver{}
blocks, there is no need to bind a listener. (You may also wish to restart Nginx just to ensure that you are using the current config, and that there are no other problems).