Apache won't serve pages

Issues related to applications and software problems
Post Reply
Pumpino
Posts: 154
Joined: 2007/12/03 00:30:47
Location: Melbourne, Australia

Apache won't serve pages

Post by Pumpino » 2014/07/09 23:28:06

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?

User avatar
avij
Retired Moderator
Posts: 3039
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: Apache won't serve pages

Post by avij » 2014/07/10 04:02:28

Any error messages? Anything in /var/log/httpd ?

Pumpino
Posts: 154
Joined: 2007/12/03 00:30:47
Location: Melbourne, Australia

Re: Apache won't serve pages

Post by Pumpino » 2014/07/10 05:32:10

Nothing in the Apache log. That's what makes me think it's a firewall issue, but port 80 is open.

User avatar
avij
Retired Moderator
Posts: 3039
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: Apache won't serve pages

Post by avij » 2014/07/10 08:48:06

What happens when you try to view your page? What kind of error message do you get in your web browser?

Pumpino
Posts: 154
Joined: 2007/12/03 00:30:47
Location: Melbourne, Australia

Re: Apache won't serve pages

Post by Pumpino » 2014/07/10 09:35:30

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.

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

Re: Apache won't serve pages

Post by TrevorH » 2014/07/10 09:44:17

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.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
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

Pumpino
Posts: 154
Joined: 2007/12/03 00:30:47
Location: Melbourne, Australia

Re: Apache won't serve pages

Post by Pumpino » 2014/07/10 10:06:23

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?

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

Re: Apache won't serve pages

Post by TrevorH » 2014/07/10 10:46:57

I doubt it.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
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

Post Reply

Return to “CentOS 7 - Software Support”