throughput of the webserver. All major http-clients support compression by
announcing it in the Accept-Encoding header. This is used to negotiate the
most suitable compression method. We support deflate, gzip and bzip2.
deflate (RFC1950, RFC1951) and gzip (RFC1952) depend on zlib while bzip2
depends on libbzip2. bzip2 is only supported by lynx and some other console
text-browsers.
We currently limit to compression support to static files.
Caching
-------
mod_compress can store compressed files on disk to optimize the compression
on a second request away. As soon as compress.cache-dir is set the files are
compressed.
(You will need to create the cache directory if it doesn't already exist. The web server will not do this for you. The directory will also need the proper ownership. For Debian/Ubuntu the user and group ids should both be www-data.)
Keep in mind that compressed JavaScript and CSS files are broken in some
browsers. Not setting any filetypes will result in no files being compressed.
NOTE: You have to specify the full mime-type! If you also define a charset, for example, you have to use "text/plain; charset=utf-8" instead of just "text/plain".
in the config/app.cfg file in your TurboGears application. The above lines should already be in the file. You just need to remove the comment symbol in front of the lines to make them active.
Django
------
To compress dynamic content with Django please enable the GZipMiddleware ::
MIDDLEWARE_CLASSES = (
'django.middleware.gzip.GZipMiddleware',
...
)
in the settings.py file in your Django project.
Catalyst
--------
To compress dynamic content with Perl/Catalyst, simply use the Catalyst::Plugin::Compress::Gzip module available on CPAN ::
use Catalyst qw(
Compress::Gzip
...
);
in your main package (MyApp.pm). Further configuration is not required.