Adding mod_deflate to Apache as a shared object

So you want to add mod_deflate to Apache but without recompiling it. You can compile just that module and add it dynamically.

What we need to do is create where the .so stands for shared object.

First find where apxs and apr-config are located. For me it was in /usr/local/apache/bin

Edit the apr-config file and change this line:


to this one:


Then go to your Apache source files (or download them off of Go to modules/filters and find the mod_deflate.c file.

Run this:

apxs -c mod_deflate.c

You should now have these files:


Notice there is no file there. This is where I got stuck. Fortunately on Apache’s site they indicate to do this:

apxs -i -a -n deflate

That creates the file, puts it in the modules folder, and adds this to your httpd.conf:

LoadModule deflate_module modules/

There you go.

Reddit it | Digg this | Stumble It | add to

One Comment

  1. Tom:

    Great post, and really well explained. Saved me a whole lot of trouble with a server running the deprecated centos 4!

Leave a comment