I am running Debian and Apache/2.2.22 I have gzip enabled, and I would like to know, what is my compression level and how to change it. I know this can be achieved editing php.ini, but I would like to configure it in apache. How can it be done?
You can adjust the compression level by simply adding DeflateCompressionLevel.
This line of code can range from 1 to 9, 9 being the best compression method. By default 9 is used and there is rarely any reason to specify a compression level unless your CPU usage is high due to high website usage.
Believe it or not but the documentation for mod_deflate has this information in it. In particular DeflateCompressionLevel directive is your friend. You can set the level between 1 (low) and 9 (high). It also says in the documentation that the default is zlib's default compression level.
The zlib documentation says that the default compression level is 6.
After the change my deflate.conf looked like this:
As a complement to accepted answer you could also use apache's filesMatch directive to compress all responses rather than compressing them by type:
<filesMatch "\.*$"> SetOutputFilter DEFLATE </filesMatch> DeflateCompressionLevel 7 # I prefer to use 7 for less CPU consumption on traffics DeflateMemLevel 9 DeflateWindowSize 15