Après avoir compilé et activé le module mod_deflate d’Apache, la directive suivante est à ajouter au virtual host :

<IfModule mod_deflate.c>
   SetOutputFilter DEFLATE

   # disable compression for broken browsers
   BrowserMatch ^Mozilla/4 gzip-only-text/html
   BrowserMatch ^Mozilla/4\.0[678] no-gzip
   BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
   BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

   # disable compression for images
   SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
   # disable compression for other files
   SetEnvIfNoCase Request_URI \.(?:pdf|htc)$ no-gzip dont-vary
   # disable compression for binaries and archives
   SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
   # proxy cache support
   Header append Vary User-Agent env=!dont-vary

   # deflate log support
   #DeflateFilterNote Input instream
   #DeflateFilterNote Output outstream
   #DeflateFilterNote Ratio ratio
   #LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
   #Customlog /var/log/apache2/deflate_log deflate
</IfModule>