Building a nginx debian package with third party modules

I created this manual on Debian Squeeze (amd64) with the latest version of nginx (stable) an one third party module as example.
If you want to build your own package, check for the latest versions of the modules and nginx and modify the version numbers in this manual.

1. Install build debian tools and depending packages

aptitude install build-essential dpkg-dev debhelper autotools-dev libgeoip-dev libssl-dev libpcre3-dev zlib1g-dev

2. Download latest nginx and unpack the tarball

wget http://nginx.org/download/nginx-1.0.2.tar.gz
tar xvzf nginx-1.0.2.tar.gz

3. Download additional modules

I use the nginx purge module in this example. Download the module:

wget http://labs.frickle.com/files/ngx_cache_purge-1.3.tar.gz

and create a „module“ directory if it not exists and untar the module to this directory:

mkdir nginx-1.0.2/modules
tar vfx ngx_cache_purge-1.3.tar.gz -C nginx-1.0.2/modules/

4. Get latest debian package

apt-get source nginx

You get a directory with the latest nginx source (nginx-0.7.67). We only need the „debian“ folder.

5. Copy the debian folder to the new nginx folder

cp -r nginx-0.7.67/debian/ nginx-1.0.2
rm nginx-1.0.2/debian/patches/*

Don’t forget to remove the old patches !

Edit „nginx-1.0.2/debian/changelog“ and prepend:

nginx (1.0.2-1) unstable; urgency=low

  * added purge proxy module

 -- Sebastian Mogilowski   Sat, 14 May 2011 13:00:00 +0100

Note: Replace my name with your own name 🙂

Add the module to the build rules edit „nginx-1.0.2/debian/rules“ and add:

--add-module=$(CURDIR)/modules/ngx_cache_purge-1.3 \

to the „./configure“ setting.

Example:

./configure --conf-path=/etc/nginx/nginx.conf \
            --error-log-path=/var/log/nginx/error.log \
            --http-client-body-temp-path=/var/lib/nginx/body \
            --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
            --http-log-path=/var/log/nginx/access.log \
            --http-proxy-temp-path=/var/lib/nginx/proxy \
            --lock-path=/var/lock/nginx.lock \
            --pid-path=/var/run/nginx.pid \
            --with-debug \
            --with-http_dav_module \
            --with-http_flv_module \
            --with-http_geoip_module \
            --with-http_gzip_static_module \
            --with-http_realip_module \
            --with-http_stub_status_module \
            --with-http_ssl_module \
            --with-http_sub_module \
            --with-ipv6 \
            --with-mail \
            --with-mail_ssl_module \
            --add-module=$(CURDIR)/modules/ngx_cache_purge-1.3 \
            $(CONFIGURE_OPTS)

6. Build the package

cd nginx-1.0.2
dpkg-buildpackage -b

7. Install

dpkg -i nginx_1.0.2-1_amd64.deb

This Post Has 4 Comments

Schreibe einen Kommentar

eMail-Benachrichtigung bei weiteren Kommentaren.
Auch möglich: Abo ohne Kommentar.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.