'Cannot access Apache in docker on EC2 on port 80 using a browser

I'm new to docker, and I'm trying to run an instance on AWS using EC2.

I ran the following command:

sudo docker run -dit -p 80:80  httpd:2.4 

With docker ps I have the following:

CONTAINER ID   IMAGE       COMMAND              CREATED         STATUS         PORTS                               NAMES
04f62e26594e   httpd:2.4   "httpd-foreground"   5 seconds ago   Up 4 seconds   0.0.0.0:80->80/tcp, :::80->80/tcp   kind_cray

The security group is configured as below:

EC2 security group

However when trying to access the instance through the browser using the address https://ec2-a-b-c-d.us-east-1.compute.amazonaws.com I get the error ERR_CONNECTION_REFUSED.

What could be happening?



Solution 1:[1]

https://ec2-15-229-1-156.sa-east-1.compute.amazonaws.com I get the error ERR_CONNECTION_REFUSED.

You get error because you are using HTTPS. You have to use only HTTP, as by default ec2 instances do not support https.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marcin