Opening Port 80 on Aws

I created a AWS EC2 VPS(ubuntu v14) on which I want to open port 80 so that my website can run.

But unfortunately, I am not able to open port 80.

For this, I first ran the command:

$ sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT

with this is what i get when I run

 $sudo iptables -L

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

I see, tcp dpt:http is ACCEPTED.

But when I run nmap to check port 80 it say port 80 is closed. See below:

$ nmap x.x.x.x -p80

Starting Nmap 6.40 (  ) at 2015-05-27 09:13 UTC
Nmap scan report for ec2-52-8-104-113.us-west-1.compute.amazonaws.com (x.x.x.x)
Host is up (0.00038s latency).
PORT   STATE  SERVICE
80/tcp closed http

Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds

I am really stuck with this, please help me.

I have even tried ufw, but that also did not help.

Thanks

2

3 Answers

Your iptables rule is correct. With that rule, you are basically telling iptables to accept any incoming TCP connections to destination port 80 (http) on your VPS. Technically, this rule isn't necessary since your INPUT chain policy is set to ACCEPT, which accepts any packet that traverses that chain.

Your Nmap scan reveals that the port is closed. The reason for this is your VPS is responding to the Nmap scan with some sort of "port not available" error, resulting in the closed port status. If iptables were dropping the packets, you would see filtered as the port status.

Try running netstat -anp | grep :80 on your VPS. If the output is empty, then you do not have a web server listening on TCP port 80. If you're running Apache2 as your web server, the command output should look similar to this:

tcp6 0 0 :::80 :::* LISTEN 1970/apache2

It causes you going to wrong way when you working with EC2 on AWS, Go to your EC2 console and click on your EC2 security group, in incoming section add HTTP (port 80) and save.

You can open HTTP port for specifying IP address or for everyone by IP address 0.0.0.0

After saving your security group, you must have access to your EC2 HTTP port.

To open a port 80 on aws instance

goto instance

please cheak outbound rules..

if there is not open 80 port then

please select http and open 80 port

also there u can open port 443 for https

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest