I really felt in love with Nginx I am using it and experimenting with it. As I already said in a previouse post about Compiling Nginx with gzip_static, one of the features I like the most is the gzip_static.
Nginx can serve gzipped content in two ways.
- Compressing it on the fly
- Serving previously compressed files
I like the latter a lot, but unfortunately I do not know about a Linux Distribution thats comes with that feature enabled. Even the source you download from Nginx page have this feature disabled by default.
Therefore, we need to compile it by ourselves. Compiling Nginx or any other software is something that usually scares people. It should not be that way. One reason to avoid, building software could be having to keep track of updates to new versions. As shown in the link above, this is not true for Arch Linux, and neither is for Debian or Ubuntu.
Prepare the system
This will download all dependencies needed to build the package.
Here we will donwload the sources from Debian repo (Enable src in your sources.list).
Enable the gzip_static option
Edit the file nginx-0.6.32/auto/options (The version of nginx for you may be different).
Look for this line
Enter in the nginx directory.
Install Nginx on Debian or Ubuntu
apt-get build-dep nginx
apt-get source nginx
HTTP_GZIP_STATIC=NOAnd change it to:
dpkg-buildpackage -uc -b
sudo dpkg -i ../nginx_0.6.32-3+lenny3_i386.debYour version may be different.
Now you have installed Nginx with support for gzip static, and is the current version of the Debian or Ubuntu you are running.
Keep in mind that when a new version becomes available, and you upgrade your system, the custome compiled version will be overwritten. You will have to do this process again.