Mod deflate in Apache 2 is a great way to save on server bandwidth since it can compress files (js/xml/html/css) before it is sent to the client. Most web browsers support gzip compression (90%+) so this is a great way to reduce the amount of traffic sent by the server. It also helps with the Google Page Speed result.
To setup Apache2 with mod deflate in Debian, enable mod deflate:
This should place 2 files inside /etc/apache2/mods-enabled — deflate.conf and deflate.load.
Edit deflate.conf and copy the following configuration. This configuration is for compressing html, js, css, xml, and text files. It also ignores compression for browsers without support for gzip compression.
AddOutputFilterByType DEFLATE text/html text/plain text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE text/plain text/xml text/x-js text/css
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0 no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
After completing the changes, restart the Apache2 service