Port 80 not accessible Amazon ec2
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
Another option is to disable the internal firewall all together. However, make sure you know what you're doing.
Solution 2
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
Solution 3
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.
Related videos on Youtube
Jasper
Updated on September 18, 2022Comments
-
Jasper over 1 year
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:
$ wgethttp://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-
Jasper almost 11 yearsI 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)
-
Ramhound almost 11 yearsHave 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?
-
Jasper almost 11 years$ wget ec2-w-x-y-z.us-west-1.compute.amazonaws.com:8080 works too. Anything else to try?
-
Ramhound almost 11 yearsIt 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.
-
-
Mogget over 10 yearsThis sounds like something one should not do. One might as well just open the needed ports instead, giving layered security instead.
-
filype over 10 yearsYou're right, from the menu you can actually just easily customize to only allow your HTTP traffic.