{"id":534,"date":"2012-12-19T10:51:55","date_gmt":"2012-12-19T17:51:55","guid":{"rendered":"http:\/\/10kdev.ivystreetinc.com\/?p=534"},"modified":"2012-12-19T10:51:55","modified_gmt":"2012-12-19T17:51:55","slug":"apache-http-file-compression","status":"publish","type":"post","link":"http:\/\/10kdev.net\/?p=534","title":{"rendered":"Apache HTTP File Compression"},"content":{"rendered":"<p>Here are the settings I use on an Apache HTTP Server to compress files automatically when served. \u00a0Most browsers have the tools internal to decompress the payloads once they get them.<\/p>\n<h3>Configuration<\/h3>\n<p>To do automatic file compression for test type files from the Apache HTTP server, in <strong>httpd.conf<\/strong>:<br \/>\n1. Uncomment this entry; the file is included by default in the Apache installation:<br \/>\n<code><br \/>\nLoadModule deflate_module modules\/mod_deflate.so<br \/>\n<\/code><\/p>\n<p>2. Add this configuration to the bottom of the file:<br \/>\n<code><br \/>\n#Compression<br \/>\n#compress these types<br \/>\nAddOutputFilterByType DEFLATE text\/html text\/plain text\/xml text\/css text\/javascript application\/json application\/javascript application\/xml<\/code><\/p>\n<p><code>#filter out browsers that can't handle compression<br \/>\nBrowserMatch ^Mozilla\/4 gzip-only-text\/html<br \/>\nBrowserMatch ^Mozilla\/4\\.0[678] no-gzip<br \/>\nBrowserMatch \\bMSIE !no-gzip !gzip-only-text\/html<\/code><\/p>\n<p><code> <\/code><\/p>\n<p><code> #turn this logging on to test, but off for normal deployment<br \/>\n#DeflateFilterNote Input input_info<br \/>\n#DeflateFilterNote Output output_info<br \/>\n#DeflateFilterNote Ratio ratio_info<br \/>\n#LogFormat '\"%r\" %{output_info}n\/%{input_info}n (%{ratio_info}n%%)' deflate<br \/>\n#CustomLog logs\/deflate.log deflate<br \/>\n<\/code><\/p>\n<p>3. Restart the Apache HTTP server.<\/p>\n<p>This will compress the static content files, bypassing images. \u00a0The browser will automatically decompress the files for the user.<\/p>\n<h3>Testing<\/h3>\n<p>To test your configuration, uncomment the logging section (restart) and hit the application a few times, you will see entries in logs\/deflate.log. Make sure to comment the logging again so the file does not grow (restart).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are the settings I use on an Apache HTTP Server to compress files automatically when served. \u00a0Most browsers have the tools internal to decompress the payloads once they get them. Configuration To do automatic file compression for test type files from the Apache HTTP server, in httpd.conf: 1. Uncomment this entry; the file is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/10kdev.net\/index.php?rest_route=\/wp\/v2\/posts\/534"}],"collection":[{"href":"http:\/\/10kdev.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/10kdev.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/10kdev.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/10kdev.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=534"}],"version-history":[{"count":8,"href":"http:\/\/10kdev.net\/index.php?rest_route=\/wp\/v2\/posts\/534\/revisions"}],"predecessor-version":[{"id":542,"href":"http:\/\/10kdev.net\/index.php?rest_route=\/wp\/v2\/posts\/534\/revisions\/542"}],"wp:attachment":[{"href":"http:\/\/10kdev.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/10kdev.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=534"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/10kdev.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}