Apache (httpd) is not working on external IP address after fresh install of CentOS.

By default port 80 is not added in the accepted of the builtin firewall/iptables of CentOS. Below is the default content of the ip tables.
/***************************************************************/
# Generated by iptables-save v1.3.5 on Thu Nov 22 14:43:27 2012
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [4076:351018]
:RH-Firewall-1-INPUT – [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -p tcp -m tcp –dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp -m icmp –icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p esp -j ACCEPT
-A RH-Firewall-1-INPUT -p ah -j ACCEPT
-A RH-Firewall-1-INPUT -d 224.0.0.251 -p udp -m udp –dport 5353 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp –dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp –dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state RELATED,ESTABLISHED -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state –state NEW -m tcp –dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT –reject-with icmp-host-prohibited
COMMIT
# Completed on Thu Nov 22 14:43:27 2012
/****************************************************************/

Solution:

Add port 80 in the whitelist of builtin firewall of Centos.

$/sbin/iptables -I RH-Firewall-1-INPUT -p tcp -m tcp –dport 80 -j ACCEPT

After, save it by executing the command below.
$/sbin/service iptables save

Leave a Reply