Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a VPS on CentOS that uses Apache to host my Rails site.

Every couple of days or so I am finding that the web server has stopped. I have to log in and restart it.

From what I can see I have a 0 byte error log, so no errors are being reported. From the access log, I can't see any traffic spikes. My site isn't popular at all anyway.. perhaps 1-5 visits per day!

I'm not sure where else to look. How can I find out what's going wrong?

share|improve this question

migrated from Nov 18 '10 at 17:02

This question came from our site for pro webmasters.

2 Answers 2

Most likely is that you're running out of memory and the kernel is killing httpd. Do you see OOM messages in the system log? (Not just the apache log.)

share|improve this answer
Can't find any out of memory messages in the logs - but I could well be looking in the wrong place. Will do some research.. –  Mongus Pong Nov 18 '10 at 18:39
You may see the oom-killer messages simply by typing dmesg. If you're lucky. –  mattdm Nov 18 '10 at 19:48
dmesg shows up nothing. –  Mongus Pong Nov 19 '10 at 9:32

A functioning Apache error log should never be empty -- as long as you're configured for loglevel Notice and up, you should get messages at every server startup being written into your error log. With a stock install on CentOS, for example, a fresh error log looks like this:

 [Sun Nov 14 04:02:05 2010] [notice] Digest: generating secret for digest authentication
 [Sun Nov 14 04:02:05 2010] [notice] Digest: done
 [Sun Nov 14 04:02:05 2010] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.2 mod_ssl/2.2.15 OpenSSL/0.9.8e-fips-rhel5 configured -- resuming normal operations

I'd wager you either have the wrong log (double-check your Apache config instead of just assuming it's the one under /var/log/httpd or wherever) or your log isn't writable for some reason. Log rotation is another possible reason, though usually logrotate will restart the Apache process after it's done.

Speaking of logrotate, do you find that your service tends to stop on any particular day of the week? Logrotate runs once per week, and it's possible the HUP it sends your httpd process is not restarting it correctly.

Do still definitely take mattdm's advice and check dmesg for OOMkiller messages, especially if you're on a VPS (most VPS hosts love to enable memory overcommit).

share|improve this answer
Ok, yes I had the wrong error log. The only useful info I have from the correct error log is that it warns I may have has an unclean shutdown when I restart. –  Mongus Pong Nov 18 '10 at 18:27

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.