Passenger (Mod_rails) and Problems With Custom Apache Installation

This week we started to test mod_rails in a couple of projects where I work on. One in production.

Of course it’s too early for any conclusions, but I just wanted to share a couple of problems you might find when the installer tries to compile the Apache module.

In our case, and I believe it is the case of many servers out there, we have a custom Apache installation, what makes the installer not find it and/or not find the Apache Portable Runtime (APR) sometimes.

The first one is easy and is documented here. You just seed to export the following environment variable, pointing to your apache installation:

export APXS2=/opt/apache2/bin/apxs

The second one is a bit tricky but it happened only when I tried to install passenger in another server that had CentOS. In this case, you will also need the following environment variable, pointing to your Apache APR config:
export APR_CONFIG=/usr/local/apache2/bin/apr-1-config

It took me a fair amount of time googling around to find this answer, so I hope it’ll be useful for someone. :)