Compressing Content on the Fly


#Apache 2 mod_deflate AddOutputFilterByType DEFLATE text/html text/plain       text/xml SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$      no-gzip dont-vary BrowserMatch ^Mozilla/4 gzip-only-text/html #Apache 1.3 mod_gzip mod_gzip_static_suffix .gz AddEncoding gzip .gz mod_gzip_item_include file \.html$


The mod_deflate filtering module included with Apache 2 provides a filter, DEFLATE, that can compress outgoing data. Compressing can be expensive in terms of CPU, but has the advantage of minimizing the amount of data that will be transferred to the client. This is useful when clients connect to the Internet via slow links and the content can be compressed significantly, such as with HTML pages. Other content that is already compressed, such as ZIP files or JPEG images, will benefit very little (if at all) from additional compression. Of course, for content compression to work, the client must support the opposite functionality: decompression. This is true for most modern browsers.

If you know that a specific client has trouble processing compressed content of a certain type, you can set up the environment variable no-gzip by using the SetEnvIf or BrowserMatch directive. This will prevent mod_deflate from compressing the content delivered to the client, as shown in the example.

Apache 1.3 has an equivalent module, mod_gzip, that can compress dynamic and static content: http://sourceforge.net/projects/mod-gzip/.




Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net