A helpful Apache safety tip
This is a two part safety tip:
- most things that roll Apache logfiles
SIGHUPApache to get it to close and reopen the logfiles
- when Apache is
SIGHUP'd, it closes its current set of sockets and tries to listen on the set that its configuration file says it should use.
So, if you have changed Apache's configuration of what it should listen on, and something else is currently camped on one of those places, something that is scheduled to be killed off during an impending reboot, and your logfiles roll before that reboot, your entire webserver will evaporate in a cloud of:
[notice] SIGHUP received. Attempting to restart
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
(Just for example.)
The 'something else' in my case was one of the lighttpd Mars movie mirrors; I had put it on a mostly disused IP address on this machine, which required changing Apache's configuration to not bind to port 80 on that IP address. Recently THEMIS took the mirroring down, so I was reverting all of the mirroring changes, and planning on having all of them take effect during the Sunday morning reboot.
Specifically, I was reverting from a series of '
directives to the usual plain '
Listen 80'. Unfortunately, you can't
bind a port to the generic wildcard address if anyone is using the
port on a specific IP address, hence the Apache restart problem. (Why
this port binding limitation is a sensible is beyond the scope of this
margin, but it is, however annoying it periodically is.)