Can't access site on EC2 instance via public ip

I've been experimenting with EC2 for a couple days and have been banging my head against simply even being able to access the sample site I've hosted. The stack is Rails 3.1.3 with Thin and Nginx.

I've tried several different configurations and finally ended up running the Nginx auto install script, which does return a webpage when I do a curl http://ec2-107-20-143-179.compute-1.amazonaws.com/. However, when I point my browser there, it hangs forever before saying the page cannot be found.

I have assigned an Elastic IP address, and I've enabled HTTP access via port 80.

I don't much experience with the sysadmin side and I'm basically stumped at this point. Any advice would be greatly appreciated.


Did you enable the http port to all ips? That would be done by going to:

EC2 -> Security Group -> Default (or your custome one) -> Inbound

And then Create a new rule for HTTP and as a source, you should assign: 0.0.0.0/0

That should do it.


Think the AWS UI may have been updated but based on Deleteman's answer

  • Login to EC2 Dashboard
  • Instances > Instances
  • Actions dropdown > Networking > Change security groups
  • You will probably see that you only have launch-wizard-1 allowed which for me only allowed SSH access on port 22
  • So as Deleteman mentions, you may need to alter your security groups...

  • Login to EC2 Dashboard
  • Network and Security > Security Groups
  • Remove any filters that may be in the search box to show all groups
  • Personally I edited the default VPC security group as this is a sandbox for me, I imagine you'll want to create a security group for your project
  • Select the security group checkbox, select actions dropdown and click "edit the inbound rules", I used the following inbound rules just to be sure it was all working
  • 规则

  • When you revisit Instances > Instances > Description, you should see the security groups and the rules
  • 在这里输入图像描述

  • Once you are happy it's working I would probably replace all traffic with HTTP and HTTPS if that's all that is needed

  • I was here earlier looking for a solution to a similar problem I was having. It turns out in my case that the EC2 instance also had its own firewall running in addition to the EC2 security group. The command 'system-config-firewall' let me get in to open the ports. Ports 80 (HTTP) and 3306 (MySQL) were not open by default. 22 (SSH) was open. I also had to do 'yum install system-config-firewall'.

    To summarize, my solution was:

    > yum install system-config-firewall
    > system-config-firewall
    
    链接地址: http://www.djcxy.com/p/5556.html

    上一篇: 将3000端口转发到生产服务器中的本地webbrick服务器

    下一篇: 无法通过公共IP访问EC2实例上的站点