You can allow webserver communication in your EC2 instance by adding port 80 (for http) and port 443 (for https) in your security group that is attached to your EC2 instance.
Step 1: Login to your AWS management console.
Step 2: Navigate to EC2 service and select your EC2 instance.
Step 3: Click on the security tab and then click on Security Groups.
Step 4: Click “Inbound rules” tab and then click on “Edit inbound rule”.
Step 5: From the drop-down select HTTP and HTTPS and click “Save rules”.
Now you will be able to connect to your EC2 instance using HTTP (port 80) or HTTPS (port 443).