I set up an EC2 instance using Ubuntu 13.10 64 bit. The instance has a security group with http 80 open to 0.0.0.0/0.
I installed nginx, restarted the server, and confirmed that nginx was running:
sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
and . . .
sudo service nginx status * nginx is running
Okay cool so then I tried to test it . . .
curl localhost curl: (7) Failed connect to localhost:80; Connection refused
Confirmed the EC2 Security Group was open: 80 (HTTP) 0.0.0.0/0
Installed Django, fired up a test at port 8000. That worked. Lot's of head scratching ensued. Then I decided to look at the ports:
netstat -an | grep ":80" tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN
Odd. So I try -- netstat -an | grep "nginx" -- and that comes back empty. Even after I restart nginx.
So now I am lost. The system tells me nginx is running but it is not. I can successfully start it, stop it, restart it and 'sudo nginx status' will report it as running. But it doesn't show up on a netstat and I cannot curl or telnet the service. If EC2 isn't blocking port 80, I figure Ubuntu might be? But it seems like nginx should fail to start and report an error. How do I resolve this issue?
** Solved - Sort Of **
Still not sure what was going on. A simple install of nginx, with the default nginx.conf should bind to 80 and accept requests. I decided to created a second instance; this time I went with the 12.04 LTS instance. I installed nginx, fired it up, it bound to Port 80, and when I tested with curl example.com and it worked. So I will terminate my old instance and go with the new one for now. But I'm bothered by the 13.10 effort so I may try that again later tonight.