Nginx is available in Debian Lenny, but the version in stable is the old 0.6.x series. Perusio maintains a useful repository with development versions built for Lenny, but it requires libraries newer than those in stable.
UPDATED: fixed ‘build-essential’ – thank you Carlos
But it is easy enough to build a deb from the Perusio package which uses the stable libraries. Here are my notes. N.B. Editing the apt sources and installing packages needs root privileges.
First, add the Perusio repository to
cat >> /etc/apt/sources.list <<EOF deb http://debian.perusio.net unstable/ deb-src http://debian.perusio.net unstable/ EOF
Update the apt-get index:
Install packaging tools (if they aren’t installed already):
apt-get install dpkg-dev apt-get install fakeroot apt-get install debhelper apt-get install build-essential
Install headers for libaries required to build Nginx:
apt-get install autotools-dev libgeoip-dev libssl-dev libpcre3-dev zlib1g-dev
Now get the package source and build a deb installation package. This part can be done as a non-root user.
apt-get source nginx cd nginx-0.9.5 dpkg-buildpackage -rfakeroot -uc -b
When I did this, the version in the repository was Nginx 0.9.5. The flag
-uc says to not sign the changes file and
-b says build a binary-only distribution. If you were cross-compiling, you can pass the
-a flag to dpkg-buildpackage specifying the build architecture.
Assuming the build was successful, your new installation package will have been created in the parent directory (bloody hell Debian tools are unintuitive).
Here I built the deb on amd64. To install this I go:
dpkg -i ../nginx_0.9.5-perusio.1.0_amd64.deb
The advantage of building Nginx from Perusio’s repository rather than directly from the source is we get the hard work of conforming to the Debian layout for free.