A helpful Apache safety tip

March 27, 2006

This is a two part safety tip:

  1. most things that roll Apache logfiles SIGHUP Apache to get it to close and reopen the logfiles
  2. 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 'Listen <IP>:80' 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.)

Written on 27 March 2006.
« Weekly spam summary on March 25th, 2006
Using threading to implement a 'busy' cursor (a tale from long ago) »

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Mon Mar 27 02:07:13 2006
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.