Compile Apache2 from source on OS X

I’ve had to reinstall apache server on my Mac and the only way to do it cleanly was to nuke my existing apache installation and compile a fresh one from source.

That’s all cool, but I could never remember what modules I needed and how to enable them.  If you don’t load any modules at compile time, this is the most likely error you’ll get when you start apache web server:

Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration

So the following steps worked well for me.

1. Download Apache 2.2 source code

2. Extract the source code and configure apache with required modules. These modules are the ones I normally need. You can customise this to your needs:

./configure  --prefix=/usr/local/apache2 \
--enable-mods-shared=all \
--enable-shared \
--enable-deflate \
--enable-proxy \
--enable-proxy-http \
--enable-ssl \
--enable-cgi \
--enable-cgid \
--enable-cache

make \

make install \

Check /usr/local/apache2/modules directory and make sure required modules have been installed.

Marko