LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Service httpd failed (https://www.linuxquestions.org/questions/linux-server-73/service-httpd-failed-540573/)

moenterprise 03-25-2007 09:24 PM

Service httpd failed
 
Hi all,

I am running Fedora Core 6 with Apache Server 2.2.3. I seem to have a problem starting the httpd service:

# /sbin/service httpd start
Starting httpd: [FAILED]

I tried this:

/usr/sbin/httpd -k start

And it worked, but for some reason, the service doesn't work. I also tried:

/usr/sbin/apachectl -k start

It would give no error, but it wouldn't start. Please help!

zaichik 03-25-2007 10:55 PM

What do you see in the Apache error_log (most likely located in /var/log/httpd)? My first guess is that you have a log file over the 2-GB size limit. It would really help to know what is being logged, though.

moenterprise 03-26-2007 12:07 PM

There is nothing in the Apache error_log about not being able to start up and it is only 160 KB. The log only shows stuff from the /usr/sbin/httpd (the working one)...

moenterprise 03-26-2007 10:05 PM

I also recently figured out that the problem was SELinux. I disabled SELinux for HTTPD and it worked but I do not know what in SELinux is causing httpd not to work...it is something to do with the httpd init script and apachectl cuz /usr/sbin/httpd works as I stated in my first post.

moenterprise 03-26-2007 10:34 PM

This is what it says in /var/log/messages:

Code:

Mar 26 23:31:42 moenterprise kernel: audit(1174966302.964:37): avc:  denied  { search } for  pid=4004 comm="httpd" name=57656220536572766572 dev=dm-0 ino=1638988 scontext=user_u:system_r:httpd_t:s0 tcontext=root:object_r:user_home_t:s0 tclass=dir

moenterprise 03-27-2007 07:47 PM

Ok. I figured it out. I have my DocumentRoot in my /home directory, therefore, I had to change the folder's security context to httpd_sys_content_t.
Then everything worked!

ashesh0326 03-27-2007 10:09 PM

moenterprise,
I had to say, I don't think putting the document root in the /home directory can be a good idea. One little bug in your script can put your entire system at risk.
Rather, I'd recommend you to get the document root to be the default; /var/www/html (or /var/www/htdocs), I think that would be much better.
Changing permissions for the /home directory cannot be a good idea, and neither can it be a good idea to change permissions for the whole apache user/group.
Better still, put your document/scripts in some other partition of your hard drive, or in some other hard drive for that matter.
One of my friends' systems got compromised this way. ;-)


All times are GMT -5. The time now is 06:53 AM.