Command-line Apache Status

Here’s another thing I have to do once per year and can never remember how to do.

If you have Apache extended status activated thusly:

<IfModule mod_status.c>
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost ip6-localhost

…then you can check in on what Apache is up to via Lynx from the command line:

$ wget -q -O - localhost/server-status | lynx -stdin

Quite handy.

Slow localhost ipv6 routing on Windows

This comes to me word-of-mouth.

It seems there’s a longstanding bug/feature in the firewall routemap that causes the ipv6 localhost link to fail, and then the v4 link is tried, and succeeds. Apache is bound to both, but Windows won’t route the v6 link correctly.

There are a couple of solutions here, including turning off ipv6 in Windows. It’s probably easiest just to explicitly define “localhost” in C:\Windows\System32\drivers\hosts. Uncommment the line: localhost
# ::1 localhost

Internal error: pcfg_openfile() called with NULL filename

Yeah, so even if you turn off basic authentication and specify a different auth method, Apache (at least some versions of it) still looks around for an auth file and throws a “pcfg_openfile() called with NULL” error when it can’t find one.  To fix, set the user auth file to /dev/null:

AuthBasicAurhorative off
AuthUserFile /dev/null

Or you can just ignore the errror I suppose. It looks more serious than it is.

The Apache service reported the following error:
>>> Unable to open logs .

I hear what you’re saying… “What the..? Nothing changed!”

Ah, but are you running Skype? If so, turn it off and try again.

Skype grabs port 80 unless that port is otherwise occupied. Launch Apache first, or choose an alternative HTTP port.

Would be nice if the error message was something a little more clear. How about “Cannot acquire port 80”? But, nah.. that would ruin all the fun.

apache2: apr_sockaddr_info_get() failed for somehost

Hypothetically speaking of course, let’s assume you forget to renew a domain name. And suddenly that domain’s email is not working. And then you notice the site is down. The next step is, logically speaking, to panic, followed by an attempt to figure out what the hell is going on. Which usually means restarting Apache. Which results in:

apache2: apr_sockaddr_info_get() failed for yourhost

Which is, wow, an exotic new error. If you see this it means that, even though Apache says its restarting, really its probably not. And now all your other sites are down. And, so, more panic. More panic for you.

Now that you’ve probably realized that the default domain name has expired, you will want to get Apache back up on a different, actually non-expired domain. Like this:

$ hostname

Now restart.

Alternatively if your hostname is set to something like “www”, probably you can change the default site in vhosts so that Apache can connect the hostname to the tld.

This is all hypothetical of course.

Alternative authentication methods with Apache 2.2

Quick note on how to make alternative authentication modules work with Apache 2.2.

mod_auth_imap kept complaining about a missing password file:

(9)Bad file descriptor: Could not open password file: (null)

Turns out with Apache 2.2 you have to explicitly turn off Basic authentication even when you are using an alternative module. So a proper Apache 2.2 mod_auth_imap configuration would look something like this:

Auth_IMAP_Enabled On
AuthBasicAuthoritative Off
AuthType Basic
Require valid-user
Auth_IMAP_Authoritative On
Auth_IMAP_Port 143
Auth_IMAP_Log On

Turning off AuthBasicAuthoritative forces Apache to ignore the standard password file authentication.