0

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?

5

You can adjust the compression level by simply adding DeflateCompressionLevel.

DeflateCompressionLevel 9

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.

3

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.

  • Where do I add this DeflateCompressionLevel? I tried to add it to apache.conf and restart apache but didn't change anything. – Firze Jun 25 '14 at 10:42
  • @Firze the documentation tells you all you need to know. I suggest that rather than having me read it for you, you educate yourself in it's usage. – Iain Jun 25 '14 at 10:48
2

With Iain's help I figured out there is mod_deflate and I have to add deflatecompressionlevel in /etc/apache2/mods-available/deflate.conf

After the change my deflate.conf looked like this:

<IfModule mod_deflate.c>
          # these are known to be safe with MSIE 6
          AddOutputFilterByType DEFLATE text/html text/plain text/xml

          # everything else may cause problems with MSIE 6
          AddOutputFilterByType DEFLATE text/css
          AddOutputFilterByType DEFLATE application/x-javascript application/javascript application$
          AddOutputFilterByType DEFLATE application/rss+xml
          DeflateCompressionLevel 9
</IfModule>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.