3

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?

0

2 Answers 2

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.)

3
  • 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.. Nov 18, 2010 at 18:39
  • You may see the oom-killer messages simply by typing dmesg. If you're lucky.
    – mattdm
    Nov 18, 2010 at 19:48
  • dmesg shows up nothing. Nov 19, 2010 at 9:32
1

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).

1
  • 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. Nov 18, 2010 at 18:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .