flash service

High_Performance_Web_Sites

Issue link: https://read.uberflip.com/i/1146286

Contents of this Issue

Navigation

Page 53 of 169

32 | Chapter 4: Rule 4: Gzip Components Apache 1.3: mod_gzip Gzip compression for Apache 1.3 is provided by the mod_gzip module. There are many mod_gzip configuration directives, and these are described on the mod_gzip web site (http://www.schroepl.net/projekte/mod_gzip). Here are the most commonly used directives: mod_gzip_on Enables mod_gzip. mod_gzip_item_include mod_gzip_item_exclude Define which requests to gzip or not to gzip based on file type, MIME type, user agent, etc. Most web hosting services have mod_gzip turned on for text/html by default. The most important configuration change you should make is to explicitly compress scripts and stylesheets. You can do this using the following Apache 1.3 directives: mod_gzip_item_include file \.js$ mod_gzip_item_include mime ^application/x-javascript$ mod_gzip_item_include file \.css$ mod_gzip_item_include mime ^text/css$ The gzip command-line utility offers an option that controls the degree of compres- sion, trading off CPU usage for size reduction, but there is no configuration directive to control the compression level in mod_gzip. If the CPU load caused by streaming compression is an issue, consider caching the compressed responses, either on disk or in memory. Compressing your responses and updating the cache manually adds to your maintenance work and can become a burden. Fortunately, there are options for mod_gzip to automatically save the gzipped content to disk and update that gzipped content when the source changes. Use the mod_gzip_can_negotiate and mod_ gzip_update_static directives to do this. Apache 2.x: mod_deflate Compression in Apache 2.x is done with the mod_deflate module. Despite the name of the module, it does compression using gzip. The basic configuration shown in the previous section for compressing scripts and stylesheets is done in one line: AddOutputFilterByType DEFLATE text/html text/css application/x-javascript Unlike mod_gzip, mod_deflate contains a directive for controlling the level of com- pression: DeflateCompressionLevel. For more configuration information, see the Apache 2.0 mod_deflate documentation at http://httpd.apache.org/docs/2.0/mod/mod_ deflate.html.

Articles in this issue

Links on this page

Archives of this issue

view archives of flash service - High_Performance_Web_Sites