EC2 instance has apache2 server installed, but I can't connect to it

Solution 1:

When you want to expose a service/port on an EC2 Instance, you need to create a security group which allows connections in that port and attach it to the instance.

So for example, you can create a security group like so: enter image description here

And when you attach it to the instance, it will allow connections on port 80 from all the world (0.0.0.0/0).

Also, I'd check that the server actually listens on this port, run:

netstat -plunt | grep "443 \|80 "

And to see that the server responds:

curl -I http://localhost

Solution 2:

Try http, not the default https. This finally worked for me.