Page 1 of 1

Apache won't serve pages

Posted: 2014/07/09 23:28:06
by Pumpino
I've configured Apache in CentOS 7 in the same way as I successfully did on a Fedora 20 server, and expected it to work. However, I've found that pages aren't being displayed.

SElinux is disabled and I've permitted port 80 in firewalld.

In my /etc/httpd/conf/http.conf, I've added:

<VirtualHost *:80>
ServerName hostname.domain.com
ServerAlias *.domain.com
DocumentRoot /home/username/www
<Directory /home/username/www>
Require all granted
</Directory>
</VirtualHost>

/home/username and /home/username/www are owned by username and permissions are set to 755.

I restarted Apache after making these changes.

Any suggestions?

Re: Apache won't serve pages

Posted: 2014/07/10 04:02:28
by avij
Any error messages? Anything in /var/log/httpd ?

Re: Apache won't serve pages

Posted: 2014/07/10 05:32:10
by Pumpino
Nothing in the Apache log. That's what makes me think it's a firewall issue, but port 80 is open.

Re: Apache won't serve pages

Posted: 2014/07/10 08:48:06
by avij
What happens when you try to view your page? What kind of error message do you get in your web browser?

Re: Apache won't serve pages

Posted: 2014/07/10 09:35:30
by Pumpino
I've resolved it. For some reason, the firewall rules were discarded (apart from ssh). I'm not sure why, as I used "firewall-cmd --permanent --zone=public --add-port=80/tcp" and then systemctl restart firewalld.service.

Re: Apache won't serve pages

Posted: 2014/07/10 09:44:17
by TrevorH
You don't need to restart firewalld after making changes, that is almost the entire point of firewalld - to allow iptables rules to be amended on the fly without affecting running services.

You probably wanted to use --add-service=http not --add-port=80/tcp. It may not make much difference in this particular case but the definition for the service can also include other things that need to be done - for example, the ftp service definition not only opens tcp port 21 but also tells it to load the nf_conntrack_ftp module.

Re: Apache won't serve pages

Posted: 2014/07/10 10:06:23
by Pumpino
OK, so I'll switch standard service rules to use "service" instead. If ssh is opened, and the port is changed, does it detect this change in /etc/ssh/sshd_config and adjust the rule automatically?

Re: Apache won't serve pages

Posted: 2014/07/10 10:46:57
by TrevorH
I doubt it.