Can't access site on EC2 instance via public ip

Solution 1:

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.

Solution 2:

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

Rules

  • When you revisit Instances > Instances > Description, you should see the security groups and the rules

enter image description here

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

Solution 3:

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

Solution 4:

This answer is for the newbies who have no idea what they are doing with an ec2 instance.

I was having the same problem and tried all the Security Group fixes to no avail.

As it turns out, I needed to turn on my server from the command line.

sudo service httpd start 

Sometimes it's dark, not because a fuse blew, but because you didn't flick the switch.