mod_deflate

mod_deflate is a modified version of
mod_compress. mod_deflate can compress any output from lighttpd static or
dynamic. It doesn't support caching compressed output like mod_compress.
mod_deflate is included in 1.5.0, see How to Install section below to use
it with 1.4.x

Module options:


deflate.enabled = "enable" 
deflate.compression-level = 9
deflate.mem-level = 9
deflate.window-size = 15
# deflate.bzip2 only in patch for 1.4.x
deflate.bzip2 = "enable" 
# deflate.allowed_encodings only in 1.5.x
deflate.allowed_encodings = ( "bzip2", "gzip", "deflate" )
deflate.min-compress-size = 200
#deflate.sync-flush = "enable" 
#deflate.output-buffer-size = 8192
deflate.work-block-size = 512
deflate.mimetypes = ("text/html", "text/plain", "text/css", "text/javascript", "text/xml")
#deflate.debug = "enable" 

The sync-flush option allows dynamic scripts to flush output to the browser
and still use compression.
work-block-size is the number of kilobytes to compress at one time, it allows
the webserver to do other work (network I/O) in between compression.
min-compress-size is the smallest response size that will be compressed.

output-buffer-size is a per connection buffer for compressed output, it can
help decrease the response size(fewer chunks to encode). If it is set to
zero or if sync-flush is enabled a shared buffer will be used.

How to install for lighttpd 1.4.x

First download the patch (download links below) and place the patch outside of the lighttpd-1.4.xx folder, then run:


patch -p0 < lighttpd-1.4.xx-mod_deflate.diff

This will patch your lighttpd-1.4.xx directory's files. Remember to change xx to the version number you are using.

Then:


cd lighttpd-1.4.11
rm -f src/Makefile.in src/Makefile
automake
./configure --with-bzip2
make
make install

Place mod_deflate after mod_rewrite in the server.modules array in the lighttpd configuration file and enter in the mod_deflate configuration options. Remember to also enable bzip2 with the --with-bzip2 flag while doing the configure.

See Also

Background Information of mod_deflate

NOTE

Patch files do NOT work with lighttpd 1.4.18 & 1.4.20
Could someone please create a new patch file?

Feature Request

#1824 adding mod_deflate to 1.4.xx tree

Known Bug

#1709 wrong content-length with mod_fastcgi/mod_deflate combo

lighttpd-1.4.10-mod_deflate.diff.bz2 (11.2 KB) jakabosky, 02/18/2006 07:29 am

lighttpd-1.4.11-mod_deflate.diff.bz2 - dynamic compression (11.2 KB) jakabosky, 03/22/2006 03:12 am

lighttpd-1.4.13.mod_deflate.patch - mod_deflate patch for lighttpd 1.4.13 (66.5 KB) qhy, 10/18/2006 04:14 pm

lighttpd-1.4.13.mod_deflate.2.patch - lighttpd 1.4.13 doesn't compile with the previous patch posted here (66.5 KB) michal.feix, 10/30/2006 07:38 am

lighttpd-1.4.13.mod_deflate.jz.patch - michal.feix did you verify that your patch is working before uploading it? Here is fixed version. (67.4 KB) janz, 12/13/2006 04:22 pm

lighttpd-1.4.19.mod_deflate.patch - It's my first patch and it works for me (Debian Etch, package from Backports). (64.8 KB) meto, 06/21/2008 06:28 pm

lighttpd-1.4.21.mod_deflate.patch - mod_deflate patch for lighttpd 1.4.21 (66 KB) al-kor, 03/07/2009 03:08 pm

mod_deflate-1.4.13-19.fix.patch - Patches for lighttpd 1.4.13-1.4.19 work incorrectly with chunked transfer-encoding (beginning of the write_queue is deflated twice) (508 Bytes) al-kor, 03/07/2009 03:31 pm

mod_deflate-1.4.19-fix-chunked-coding.patch - Fix broken chunked transfer encoding: no last-chunk in mod_cgi after adding mod_deflate (1.9 KB) geronimo, 12/16/2009 05:18 pm

lighttpd-1.4.26.mod_deflate.patch - Updated patch for 1.4.26. patches against the released tarball. (79 KB) toxic, 02/18/2010 03:35 am