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

But when i try:


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?

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 )   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

  • If you change the Apache port from port 80 does it work? A wget on localhost is of course going to work, because its localhost, that just proves the service is setup against
    – Ramhound
    Jul 10, 2013 at 11:46
  • I changed httpd.conf for apache to run on port 8080 (Listen, restarted apache, updated amazone ec2 security group to allow port 8080. But again does not work via browser on my desktop. (but wget localhost:8080 works)
    – Jasper
    Jul 10, 2013 at 11:54
  • Have you figured Apache to be visible to anything other then Sounds like you have not, since you confirmed, its not a port problem. Have you configured an Apache installation before?
    – Ramhound
    Jul 10, 2013 at 12:01
  • $ wget ec2-w-x-y-z.us-west-1.compute.amazonaws.com:8080 works too. Anything else to try?
    – Jasper
    Jul 10, 2013 at 12:02
  • It works because your hosts file was modified. Amazon gave you a public ip address connected to that url. All your hosts enteries do is redirect those domains to your local ip address which we already know work. Your problem is apache doesn't know what to do when it gets traffic from the outside.
    – Ramhound
    Jul 10, 2013 at 15:50

4 Answers 4


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


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

  • This sounds like something one should not do. One might as well just open the needed ports instead, giving layered security instead.
    – Mogget
    Nov 2, 2013 at 10:17
  • You're right, from the menu you can actually just easily customize to only allow your HTTP traffic.
    – filype
    Nov 2, 2013 at 22:17

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 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

That's it.


Check if your iptables have any rule enabled or not.

iptables -L

If there is some rules on the server you can flush them.

iptables -F


There are a few things you can do to troubleshoot.

1) Since you can't point base domains to a CNAME you need to point www.mypublichostname.com to the ec2-w-x-y-z.us-west1.blah. Alternatively (and probably a better idea) is to attach an elastic IP to the machine, and point the A record and all other records to the IP address.

2) You mention you are running this instance in VPC. With VPC security groups you have to define both incoming and outgoing security permissions. You need to ensure that ports 80 & 8080 is open both incoming and outgoing to (everyone) or your specific IP, subnet, etc.

3) VPC Routing can be a little more complex depending on how you are handling it. If you are using a jump box, or a proxy box for heightened security, you have to set that up as a gateway for outgoing traffic. Assigning an elastic IP to this instance alleviates this problem.

Hope this helps.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.