How to add secure download module


I can’t compile Nginx with the secure download module. It keeps
complaining about a missing mhash.h file. How to I tell Nginx where to
find this mhash? Do I need to install mhash or just have the sources at



there are many ways to do this, in the end the gcc which is called by
make just has to find mhash’s header files and the shared library. if
you install the mhash and mhash-dev packages and your distribution
doesn’t set it up automatically so that gcc can find it, you can still
set CFLAGS to something like -I/path/to/headers and LDFLAGS to
-L/path/to/shared/library before you do the configure.

but in the most distribution i think you shouldn’t need to do this
after installing the mhash-dev or mhash-devel


I’m running OSX Leopard, and I’m trying to install all that through the
passenger installer.

Adding the -I/path and -L/path appear as invalid options for the

./configure: error: invalid option “-I/…/mhash-”

Yeah I know one day I’ll correctly learn C.

Here is the error message even with the env vars set:

gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter
-Wunused-function -Wunused-variable -Wunused-value -Werror -g
src/event/modules -I src/os/unix -I /path/pcre-8.10 -I objs -I src/http
-I src/http/modules -I src/mail -o
error: mhash.h: No such file or directory

We can notice that the -I/usr/local/mhash- hasn’t been
injected in the gcc command line, maybe the passenger install script
overrides them or doesn’t use them.

I have contacted the developer of the module and I’m waiting for his

these are not supposed to be parameters to the configure script. they
are parameters to gcc. so if you want that your make passes those to
gcc you need to set those two env variables before you execute the
configure like f.e.:

export CFLAGS="-I/usr/local/mhash-"
export LDFLAGS="-L/usr/local/mhash-"

or you could also try to manually edit objs/Makefile after running
configure and add the two parameters like this:

3 CFLAGS = -I/usr/local/mhash-
4 CPP = -I/usr/local/mhash-
5 LINK = $(CC) -L/usr/local/mhash-

you just need to make sure that gcc has the -I parameter while
compilation and the -L parameter while linking

yes, seems that for some reason the configure which is run by
passenger doesn’t take your environment variables. i have never used
passenger before, but if there is some way for you to stop after the
configure and then later continue with the make you could maybe try to
hack the objs/Makefile inbetween.


By compiling Nginx manually (without support for passenger), I can go a
bit further, but I now hit a new problem:

error: mutils/mhash_config.h: No such file or directory

When I locate the missing file I see:


What is that? What’s that 0.9.9 folder doing here?

Does it mean I need to add an additional -I folder? How to do that with

i guess the .in file is somwhere in the source of the library that you
downloaded, not in the directory where the headers got installed to,

you first should know where the headers are installed to and then make
sure that gcc is getting a -I with this directory.

In my mhash folder I have not mhash_config.h !?