opening port 80 on AWS

6,472

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

Share:
6,472

Related videos on Youtube

Raja Malik
Author by

Raja Malik

Updated on September 18, 2022

Comments

  • Raja Malik
    Raja Malik over 1 year

    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 ( http://nmap.org ) 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

    • Raja Malik
      Raja Malik almost 9 years
      I noticed that after allowing connections on port 80, I do not see www service but http service. Is there a difference between two? What I do not see is - dpt:www but dpt:http.
    • bain
      bain about 8 years