I have started a Amazon EC2 instance (Linux Redhat)... And Apache as well.

But when i try:

http://MyPublicHostName

I get no response.

I have ensured that my Security Group allows access to port 80.
I can reach port 22 for sure, as i am logged into the instance via ssh.
Within the Amazon EC2 Linux Instance when i do:
$ wget http://localhost
i do get a response. This confirms Apache and port 80 is indeed running fine.

Since Amazon starts instances in VPC, do i have to do anything there... Infact i cannot even ping the instance, although i can ssh to it!

Any advice?

EDIT:
Note that i had edited /etc/hosts file earlier to make 389-ds (ldap) installation work.

My /etc/hosts file looks like this(IP addresses as shown as w.x.y.z )
127.0.0.1   localhost.localdomain localhost
w.x.y.z   ip-w-x-y-z.us-west-1.compute.internal
w.x.y.z   ip-w-x-y-z.localdomain


Solution 1:

By default the RedHat firewall blocks some ports, including port 80. This is in addition to the Firewall configured on Amazon AWS through the Security Group.


You can customize the firewall to allow your HTTP traffic.

$ sudo system-config-firewall-tui

firewallhttpconfigforredhat

Another option is to disable the internal firewall all together. However, make sure you know what you're doing.

Solution 2:

If you haven't touched security group settings before, they are closed.

  • First you need to find, what security group your server is assigned to.
  • In list of instances click the server, then you see description of the instance below
  • In right column there is Security group name. Under the link View rules you see what ports are opened. Default is only 22. If there is no 80 port, you need to add it.
  • Next you need to add rule for 80 port. Open Security groups from left menu and click your security group.
  • Below you see Details about group.
  • Click tab Inbound and select HTTP from the menu (or add custom port). Leave the source as it is 0.0.0.0/0 if you need public access.
  • Click Add rule. NB! You need to click Apply rule changes, too, although the rule appeared in the list already after the first click. Changes, waiting for Apply are indicated by asterisk at the tab heading.
  • No need to add outgoing, as this is opened by default (you may check if there is rule ALL 0.0.0.0/0)

That's it.