Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
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 127.0.0.1 –  Ramhound Jul 10 '13 at 11:46
    
I changed httpd.conf for apache to run on port 8080 (Listen 0.0.0.0:8080), 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 '13 at 11:54
    
Have you figured Apache to be visible to anything other then 127.0.0.1? Sounds like you have not, since you confirmed, its not a port problem. Have you configured an Apache installation before? –  Ramhound Jul 10 '13 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 '13 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 '13 at 15:50
add comment

3 Answers

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


From the menu, you can customize the firewall to allow your HTTP traffic.

$ sudo system-config-firewall-tui

firewallhttpconfigforredhat

Alternatively, you can easily disable the internal firewall all together. However, for production and non Amazon AWS systems, this may not be desired since firewall security will be compromised.

share|improve this answer
    
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 '13 at 10:17
    
You're right, from the menu you can actually just easily customize to only allow your HTTP traffic. –  Filype Nov 2 '13 at 22:17
add comment

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 0.0.0.0/0 (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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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