Wednesday, March 19, 2008

Apache won't start and there is nothing in the logs

Chance are, if apache isn't starting and isn't logging anything, the error_log is full preventing apache from starting. To double check that, run:

cd /var/log/httpd
ls -lS | less
If any file is around 2-3 gig (or more), then chances are, that's the problem.

The solution is to remove the logs, restart apache, and then implement preventative measures.

1)

cd /var/log/httpd/
rm -f error_log
rm -f access_log
rm -f suexec_log
rm -f fpexec_log
/sbin/service httpd restart ("/usr/local/etc/rc.d httpd restart" for FreeBSD)


2) Get logrota to rotate daily

perl -pi -e 's/weekly/daily/' /etc/logrotate.conf
perl -pi -e 's/rotate 4/rotate 2/' /etc/logrotate.conf



If apache still doesn't start, check /var/log/messages and try recompiling apache.

No comments: