Build Nginx RPM With ngx_cache_purge module

I’m not going have much words to say, here we go..

first download nginx source rpm from this excellent contributor/packager and install the source

$ wget http://centos.alt.ru/pub/nginx/0.9/RHEL/SRPMS/nginx-0.9.5-1.el5.src.rpm
$ rpm -Uvh  nginx-0.9.5-1.el5.src.rpm

Change to /path/rpm/SOURCE and download ngx_cache_purge

$ cd `rpm --eval '%{_sourcedir}'`
$ wget http://labs.frickle.com/files/ngx_cache_purge-1.2.tar.gz

Now we need to modified nginx.spec a bit, so it will include ngx_cache_purge module when compiled

$ cd `rpm --eval '%{_specdir}' `
$ vi nginx.spec

Add ngx_cache_source-1.2.tar.gz module to source list as Source20

Source11:       nginx_mod_h264_streaming-2.2.7.tar.gz
Source20:       ngx_cache_purge-1.2.tar.gz

In %prep section add this line %setup -T -D -a 20

%setup -T -D -a 11
%setup -T -D -a 20
%setup -T -D -a 21

In %build section add this line –add-module=%{_builddir}/nginx-%{version}/ngx_cache_purge-1.2 \

...
    --add-module=%{_builddir}/nginx-%{version}/nginx_upload_module-2.2.0 \
    --add-module=%{_builddir}/nginx-%{version}/ngx_cache_purge-1.2 \
    --add-module=%{_builddir}/nginx-%{version}/nginx_mod_h264_streaming-2.2.7
...