4

I am trying to test a simple http server on ec2 with port 8080 by python -m SimpleHTTPServer 8080 but it is not working. I have added the security group for TCP 8080, tried ALL TCP and even all All traffic. But still I cannot open the Public_DNS_IPv4:8080 in the browser. I checked on the ec2 is listening to 8080 as per netstat below. My ec2 AMI ID is amzn-ami-hvm-2017.09.1.20180115-x86_64-gp2 (ami-97785bed)

Interestingly, if I ran sudo python -m SimpleHTTPServer 80 then it is working on Public_DNS_IPv4

Can any one help to see what I have missed?

enter image description here

[ec2-user@XXXXXXX ~]$ python -m SimpleHTTPServer 8080
Serving HTTP on 0.0.0.0 port 8080 ...


[ec2-user@XXXXXXX ~]$ netstat -tulpn  | grep 8080
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:8080                0.0.0.0:*                   LISTEN      8844/python

UPDATED Network ACL

enter image description here enter image description here

route table enter image description here

Ted Xu
  • 1,095
  • 1
  • 11
  • 20
  • 2
    Do you have any network ACLs or iptables rules on the EC2 instance? – c3st7n Mar 10 '18 at 01:12
  • 2
    Post your route table and NACL (inbound and outbound). The reason that you had to use sudo for port 80 is that all ports below 1024 require privilege to open. – John Hanley Mar 10 '18 at 04:13
  • 1
    @JohnHanley thx, I have posted the Network ACL. think it is ok? – Ted Xu Mar 12 '18 at 17:38
  • 1
    Your NACLs and Route Table are correct. I don't know what is wrong. Did you configure anything else on this instance such as iptables? – John Hanley Mar 12 '18 at 17:59
  • 1
    i didn't, I created a new instance and only touched security group to all traffic. – Ted Xu Mar 12 '18 at 18:09

1 Answers1

2

it turns out to be my network firewall setup causing the issue, only certain ports are open.

Ted Xu
  • 1,095
  • 1
  • 11
  • 20