amazon ec2 - How to configure direct http access to EC2 instance? -
this basic amazon ec2 question, i'm stumped here goes.
i want launch amazon ec2 instance , allow access http on ports 80 , 8888 anywhere. far can't allow instance connect on ports using own ip address (but connect localhost).
i configured "default" security group http using standard http option on management console (and ssh).
i launched instance in default security group.
i connected instance on ssh port 22 twice , in 1 window launch http server on port 80. in other window verify can connect http using "localhost".
however when try access http instance (or anywhere else) using either public dns or private ip address het "connection refused".
what doing wrong, please?
below console fragment showing wget succeeds , 2 fail run instance itself.
--2012-03-07 15:43:31-- http://localhost/ resolving localhost... 127.0.0.1 connecting localhost|127.0.0.1|:80... connected. http request sent, awaiting response... 302 moved temporarily location: /__whiff_directory_listing__ [following] --2012-03-07 15:43:31-- http://localhost/__whiff_directory_listing__ connecting localhost|127.0.0.1|:80... connected. http request sent, awaiting response... 200 ok length: unspecified [text/html] saving to: “__whiff_directory_listing__” [ <=> ] 7,512 --.-k/s in 0.03s 2012-03-07 15:43:31 (263 kb/s) - “__whiff_directory_listing__” saved [7512] [ec2-user@ip-10-195-205-30 tmp]$ wget http://ec2-50-17-2-174.compute-1.amazonaws.com/ --2012-03-07 15:44:17-- http://ec2-50-17-2-174.compute-1.amazonaws.com/ resolving ec2-50-17-2-174.compute-1.amazonaws.com... 10.195.205.30 connecting ec2-50-17-2-174.compute-1.amazonaws.com|10.195.205.30|:80... failed: connection refused. [ec2-user@ip-10-195-205-30 tmp]$ wget http://10.195.205.30/ --2012-03-07 15:46:08-- http://10.195.205.30/ connecting 10.195.205.30:80... failed: connection refused. [ec2-user@ip-10-195-205-30 tmp]$
the standard tcp sockets interface requires bind particular ip address when send or listen. there couple of special addresses: localhost (which you're familiar with) 127.0.0.1. there's special address, 0.0.0.0 or inaddr_any (internet protocol, special shorthand address). it's way listen on or more commonly, addresses on host. way tell kernel/stack you're not interested in particular ip address.
so, when you're setting server listens "localhost" you're telling service want use special reserved address can reached users of host, , while exists on every host, making connection localhost ever reach host you're making request from.
when want service reachable everywhere (on local host, on interfaces, etc.) can specify 0.0.0.0.
Comments
Post a Comment