<-
Apache > HTTP Server > Documentation > Version 2.0 > Modules

Apache Module mod_deflate

Description: Compress content before it is delivered to the client
Status: Extension
Module Identifier: deflate_module
Source File: mod_deflate.c

Summary

The mod_deflate module provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.

Directives

Topics

See also

top

Enabling Compression

Compression is implemented by the DEFLATE filter. The following directive will enable compression for documents in the container where it is placed:

Most popular browsers can not handle compression of all content so you may want to set the 'gzip-only-text/html' note to 1 to only allow html files to be compressed (see below).

If you set this to anything but '1' it will be ignored, so you can do negative matches.

SetEnv gzip-only-text/html 1
SetOutputFilter DEFLATE

Here is an example of enabling compression for the Apache documentation:

<Directory "/your-server-root/manual">
SetEnv gzip-only-text/html 1
SetOutputFilter DEFLATE
</Directory>

top

DeflateBufferSize Directive

Description: Fragment size to be compressed at one time by zlib
Syntax: DeflateBufferSize value
Default: DeflateBufferSize 8096
Context: server config, virtual host
Status: Extension
Module: mod_deflate

The DeflateBufferSize directive specifies the size in bytes of the fragments that zlib should compress at one time.

top

DeflateFilterNote Directive

Description: Places the compression ratio in a note for logging
Syntax: DeflateFilterNote notename
Context: server config, virtual host
Status: Extension
Module: mod_deflate

The DeflateFilterNote directive specifies that a note about compression ratios should be attached to the request. The name of the note is the value specified for the directive.

top

DeflateMemLevel Directive

Description: How much memory should be used by zlib for compression
Syntax: DeflateMemLevel value
Default: DeflateMemLevel 9
Context: server config, virtual host
Status: Extension
Module: mod_deflate

The DeflateMemLevel directive specifies how much memory should be used by zlib for compression (a value between 1 and 9).

top

DeflateWindowSize Directive

Description: Zlib compression window size
Syntax: DeflateWindowSize value
Default: DeflateWindowSize 15
Context: server config, virtual host
Status: Extension
Module: mod_deflate

The DeflateWindowSize directive specifies the zlib compression window size (a value between 1 and 15).