Apache 2.2 – HTTPD Restarts Every 24 Hours Solution

apache-2.2uptime

I have an Apache/2.2.22 (Linux/SUSE) and it automatically restarts every day at the same time. I have no cron jobs configured to do that on any user.

I started collecting minutelly snapshots of the status page and from that I found out that:

Restart Time: Friday, 31-Jan-2014 12:15:03 EET
Restart Time: Saturday, 01-Feb-2014 12:15:04 EET
Restart Time: Sunday, 02-Feb-2014 12:15:05 EET
Restart Time: Monday, 03-Feb-2014 12:15:06 EET

From the miuntelly snapshots of the status page it turns out that no significance traffic occurst before the restart.

For each restart I get the following /var/log/messages without anything else of interest:

2014-02-03T12:15:02.576970+02:00 foobar systemd[1]: Reloading apache.
2014-02-03T12:15:03.225024+02:00 foobar start_apache2[15393]: Syntax OK
2014-02-03T12:15:03.298169+02:00 foobar systemd[1]: Reloaded apache.

Any ideas why this is happening or where should I look at next?

Best Answer

Apache isn't being restarted (which implies shutting it down and starting it again). Instead, it's re-reading its config file.

I'd lay a bet that this is caused by your logrotation software.

If logs are rotated by moving the log to a new name, and creating a new file with the old name, then you need to restart apache in order to make it begin using the new file. So when rotating apache logs, you need to one of two things:

  1. Do a reload of apache configuration (which will make it start using the new logfile),
  2. Don't move the old file - instead, copy the contents to the backup file name and empty the original.