This will download all dependencies needed to build the package.
apt-get build-dep nginx
Here we will download the sources from Debian repo (Enable src in your sources.list).
cd /tmp/
apt-get source nginx
Edit the file nginx-0.6.32/auto/options (The version of nginx for you may be different). Look for this line
HTTP_GZIP_STATIC=NO
And change it to:
HTTP_GZIP_STATIC=YES
Enter in the nginx directory.
dpkg-buildpackage -uc -b
sudo dpkg -i ../nginx_0.6.32-3+lenny3_i386.deb
Your version may be different.