Apache module debugging

I have some problem using mod_xsendfile on tarragon. I’ve been working on getting this working for 2 days. I have had to get into the source code of the apache module to figure it out, and I want to turn on the debugging option to see what is going on.

So I have to recompile the c source file, with the define of _DEBUG, and install the it as a module. Had to figure out how to do this. It is very easy. But easy doesn’t mean I’ll remember it, thus this post.

I cloned the source:

git clone https://github.com/nmaier/mod_xsendfile (into my local git repo), and then cd into the directory, and

apxs -D_DEBUG -i -c mod_xsendfile.c

This creates the module with debugging defined, and puts it in /usr/lib64/httpd/modules/mod_xsendfile.so

It still needs to be loaded into apache. Instructions at his site say to use the -a flag, to activate, but while that would work on a simple site, it tries to put the LoadModule into /etc/httpd/conf/httpd.conf, and all my LoadModule statements are in files in the directory /etc/httpd/conf.modules.d so I need to create /etc/httpd/conf.modules.d/xsendfile.conf containing:

LoadModule xsendfile_module modules/mod_xsendfile.so

The module will log debug statements, but this still won’t actually get you any log records until you set LogLevel debug in the apache config file.

Then restart apache and Bob’s your uncle.