How do I get Apache to serve web pages ?

General support questions
Post Reply
Duke Nukem
Posts: 4
Joined: 2014/08/13 19:41:45

How do I get Apache to serve web pages ?

Post by Duke Nukem » 2014/08/13 23:52:29

I'm trying to set up Centos 7 in a VMWare image.

What do I need to do to get apache to serve html files ? I've put a simple html file in /var/www/html but if I try to access it via a browser it just times out. I can however ping the IP address ok.

I noticed that for some reason /etc/sysconfig/iptables is missing so I did "yum install iptables-services" and added:-

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 123 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 135 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 135 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 136 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 136 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT

I've also tried to compare httpd.conf between my working Centos 6.5 and broken Centos 7 but can't spot anything amiss.

TTFN,
Jon

PS : I'm not an expert in Linux (no, really?) but basing setup on what worked for Centos 6.5.

User avatar
TrevorH
Forum Moderator
Posts: 29995
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How do I get Apache to serve web pages ?

Post by TrevorH » 2014/08/14 00:35:00

CentOS 7 uses a new firewalld daemon by default. You manipulate the rules that that controls using the firewall-cmd command. You have to use it twice if you want to open a port now and have it perist over a reboot so e.g.

Code: Select all

firewall-cmd --add-service=http
firewall-cmd --permanent --add-service=http
Use man firewall-cmd for more and better info.
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Duke Nukem
Posts: 4
Joined: 2014/08/13 19:41:45

Re: How do I get Apache to serve web pages ?

Post by Duke Nukem » 2014/08/14 08:32:09

Fantastic, that sorted it thanks.

TTFN,
Jon

Post Reply

Return to “CentOS 7 - General Support”