Q:

How to configure mod_lua (apache) to use LuaJIT?

How do I configure mod_lua to use LuaJIT, instead of just plain Lua?

A:

I was able to compile Apache 2.3 and link mod_lua against LuaJIT 2.0b6 like this:
LUA_LIBS="-L/usr/local/lib -lluajit-51 -lm" \
LUA_CFLAGS="-I/usr/local/include/luajit-2.0" \
./configure --prefix=/usr/local \
    --enable-lua --with-lua=/dev/null --enable-luajit
make

As far as I can tell, even though there's an --enable-luajit configuration flag, the mod_lua config.m4 script only looks for lua libraries by default.
If you built LuaJIT as a dynamic library as well as a static library, you may want to explicitly link it statically:
LUA_LIBS="/usr/local/lib/libluajit-5.1.a -lm"

(You may have to change the paths depending on which version of LuaJIT you have installed, and where.  Caveat lector: I didn't actually install and test the results of this.)

