Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Setup

I have just set up a new CentOS 6.2 server running httpd. I set httpd to run as apache:apache. I also set up all of my files under the site to belong to apache:apache (chown -R apache:apache httpdocs/) as well as to have permissions 0755 (chmod -R 0755 httpdocs/). The httpd process is set to run as a service so it start automatically at startup. This is where the problem lies.

The Problem

When I restart my server I assume that the service starts httpd. I show that it is running (ps -aux |grep httpd). I also see that it is running as apache. However, when I try and go to the site I get a 403 forbidden. If I stop the service (service httpd stop) and refresh I see the site is unavailable. If I start httpd (httpd -k start) the site comes up just like it should. Why would the site be forbidden when run as a service but work the other way?

Diagnostics

service httpd start

UID        PID  PPID  C STIME TTY          TIME CMD
apache   12753 12752  0 09:24 ?        00:00:00 httpd -k start
apache   12754 12752  0 09:24 ?        00:00:00 httpd -k start
apache   12755 12752  0 09:24 ?        00:00:00 httpd -k start
apache   12756 12752  0 09:24 ?        00:00:00 httpd -k start
apache   12757 12752  0 09:24 ?        00:00:00 httpd -k start
apache   12758 12752  0 09:24 ?        00:00:00 httpd -k start
apache   12759 12752  0 09:24 ?        00:00:00 httpd -k start
apache   12760 12752  0 09:24 ?        00:00:00 httpd -k start
apache   12761 12752  0 09:24 ?        00:00:00 httpd -k start

httpd -k start

UID        PID  PPID  C STIME TTY          TIME CMD
apache   12899 12898  0 09:14 ?        00:00:00 httpd -k start
apache   12900 12898  0 09:14 ?        00:00:00 httpd -k start
apache   12901 12898  0 09:14 ?        00:00:00 httpd -k start
apache   12902 12898  0 09:14 ?        00:00:00 httpd -k start
apache   12903 12898  0 09:14 ?        00:00:00 httpd -k start
apache   12904 12898  0 09:14 ?        00:00:00 httpd -k start
apache   12905 12898  0 09:14 ?        00:00:00 httpd -k start
apache   12906 12898  0 09:14 ?        00:00:00 httpd -k start
apache   12907 12898  0 09:14 ?        00:00:00 httpd -k start
apache   12914 12898  0 09:14 ?        00:00:00 httpd -k start
share|improve this question
1  
Do your /var/log/httpd/error_log and /var/log/httpd/access_log have anthing interesting to say ? –  Iain May 11 '12 at 13:46
1  
Are you somehow hitting the wrong configuration file when you start it up by hand with the httpd -k start command? This is httpd, as the CentOS package, right? The different behavior between service and manually makes me think it's either the binary (wrong PATH) or the configuration. –  cjc May 11 '12 at 13:48
    
What does the httpd error log say ? –  adaptr May 11 '12 at 14:02
    
@cjc You set me on the right path literally. It was an issue with SELinux security model. I fixed it by using the following walkthrough: wiki.centos.org/HowTos/… –  t3h-chipmunk May 11 '12 at 14:19
    
Ah, yes, SELinux. –  cjc May 11 '12 at 14:22
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.