{"id":597,"date":"2014-04-01T11:22:48","date_gmt":"2014-04-01T09:22:48","guid":{"rendered":"http:\/\/ndk.sytes.net\/wordpress\/?p=597"},"modified":"2014-04-01T11:22:48","modified_gmt":"2014-04-01T09:22:48","slug":"apache-mod_deflate","status":"publish","type":"post","link":"https:\/\/ndk.sytes.net\/wordpress\/?p=597","title":{"rendered":"Apache + mod_deflate"},"content":{"rendered":"<p>\n\tWith mod_deflate you can use on-the-fly compression for your content delivered by apache. The content is compressed before it is sent to the browser which decompresses then the received data. Almost all modern browsers support gzip decompression. Although the apache module is called mod_deflate it uses the gzip compression method.\n<\/p>\n<p>\n\tI could reduce the size of a lot of pages by almost 30-40% when delivering. As you can imagine this saves quite some bandwidth and gives you the ability to serve more pages.\n<\/p>\n<p>\n\tSo, how to implement this?\n<\/p>\n<p>\n\tfirst you have to enable mod_deflate in your httpd.conf. Usually this module is already loaded if not uncomment the line or add\n<\/p>\n<pre>\nLoadModule deflate_module modules\/mod_deflate.so<\/pre>\n<p>\n\tthen create a new .conf file in your httpd config directory (usually something like \/etc\/httpd\/conf.d) and add this\n<\/p>\n<pre>\n# add if module is enabled\n&lt;IfModule mod_deflate.c&gt;\n\n    # add content compression for given mime types\n    AddOutputFilterByType DEFLATE text\/plain\n    AddOutputFilterByType DEFLATE text\/html\n    AddOutputFilterByType DEFLATE text\/xml\n    AddOutputFilterByType DEFLATE text\/css\n    AddOutputFilterByType DEFLATE application\/xml\n    AddOutputFilterByType DEFLATE application\/xhtml+xml\n    AddOutputFilterByType DEFLATE application\/rss+xml\n    AddOutputFilterByType DEFLATE application\/javascript\n    AddOutputFilterByType DEFLATE application\/x-javascript\n\n    # set default compression level (1-9, higher number = higher compression)\n    DeflateCompressionLevel 9\n\n    # make some exceptions for problematic browsers\n    BrowserMatch ^Mozilla\/4 gzip-only-text\/html\n    BrowserMatch ^Mozilla\/4\\.0[678] no-gzip\n    BrowserMatch \\bMSIE !no-gzip !gzip-only-text\/html\n\n    # set the deflate logging notice\n    DeflateFilterNote Input instream\n    DeflateFilterNote Output outstream\n    DeflateFilterNote Ratio ratio\n\n    # and set the logging format\n    LogFormat &#39;&quot;%r&quot; %{outstream}n\/%{instream}n (%{ratio}n%%)&#39; deflate\n\n&lt;\/IfModule&gt;<\/pre>\n<p>\n\tinto a new file, e.g.&nbsp;deflate.conf, save it and restart your apache server. From now on every page loaded will be served with gzip compression.\n<\/p>\n<p>\n\tYou can also use gzip compression from .htaccess. Simply add this:\n<\/p>\n<pre>\n# add if module is enabled\n&lt;IfModule mod_deflate.c&gt;\n\n    # add content compression for given mime types\n    AddOutputFilterByType DEFLATE text\/plain\n    AddOutputFilterByType DEFLATE text\/html\n    AddOutputFilterByType DEFLATE text\/xml\n    AddOutputFilterByType DEFLATE text\/css\n    AddOutputFilterByType DEFLATE application\/xml\n    AddOutputFilterByType DEFLATE application\/xhtml+xml\n    AddOutputFilterByType DEFLATE application\/rss+xml\n    AddOutputFilterByType DEFLATE application\/javascript\n    AddOutputFilterByType DEFLATE application\/x-javascript\n\n    # make some exceptions for problematic browsers\n    BrowserMatch ^Mozilla\/4 gzip-only-text\/html\n    BrowserMatch ^Mozilla\/4\\.0[678] no-gzip\n    BrowserMatch \\bMSIE !no-gzip !gzip-only-text\/html\n\n&lt;\/IfModule&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>With mod_deflate you can use on-the-fly compression for your content delivered by apache. The content is compressed before it is sent to the browser which decompresses then the received data. Almost all modern browsers support gzip decompression. Although the apache module is called mod_deflate it uses the gzip compression method. I could reduce the size [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,4,7],"tags":[],"class_list":["post-597","post","type-post","status-publish","format-standard","hentry","category-linuxunix","category-programming","category-servers"],"_links":{"self":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/597","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=597"}],"version-history":[{"count":0,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/597\/revisions"}],"wp:attachment":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}