{"id":1175,"date":"2018-10-22T22:22:51","date_gmt":"2018-10-22T22:22:51","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=1175"},"modified":"2018-10-23T00:14:51","modified_gmt":"2018-10-23T00:14:51","slug":"install-mod_deflate-on-apache-linuxadmin-io","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/22\/install-mod_deflate-on-apache-linuxadmin-io\/","title":{"rendered":"Install mod_deflate on Apache &#8211; LinuxAdmin.io"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/linuxadmin.io\/wp-content\/uploads\/2017\/06\/mod_deflate-1.png\" alt=\"How to install mod_deflate\" width=\"559\" height=\"202\" \/><\/p>\n<p>Mod_deflate is an apache module. Prior to having mod_deflate it was mod_gzip. Post apache 2.0 mod_deflate is used, it provides a slightly better compression than mod_gzip. It allows the size of certain file types to be compressed which in-turn allows clients to be able to download these files faster. This will cause the site itself to load faster for the clients as well as part of the formula for better page ranking. You can read more about mod_deflate on <a href=\"https:\/\/httpd.apache.org\/docs\/current\/mod\/mod_deflate.html\">Apache.org<\/a>.<\/p>\n<p>Requirements:<\/p>\n<p>This guide assumes you already have Apache running as a webserver. If you don\u2019t, please see <a href=\"https:\/\/linuxadmin.io\/compile-apache-2-4-source\/\">Install Apache on CentOS<\/a><\/p>\n<h2>Enable the mod_deflate module<\/h2>\n<p>The deflate module is part of the apache core package, so there is no need to compile additional modules, all that is required is to enable in the Apache configuration.<\/p>\n<p>Verify its not already loaded:<\/p>\n<p># httpd -M 2&gt;&amp;1|grep deflate<br \/>\n#<\/p>\n<p>Edit the main Apache configuration:<\/p>\n<p>nano \/etc\/httpd\/conf\/httpd.conf<\/p>\n<p>Un-comment the following line:<\/p>\n<p>LoadModule deflate_module lib\/apache\/mod_deflate.soRestart apache to confirm the module loaded<\/p>\n<p>service httpd restart<\/p>\n<p>Check for the loaded module again, you should see it return a result<\/p>\n<p># httpd -M 2&gt;&amp;1|grep deflate<br \/>\ndeflate_module (shared)<\/p>\n<h2>Configure mod_deflate<\/h2>\n<p>Create a new configuration file:<\/p>\n<p>nano \/etc\/httpd\/conf.d\/deflate.conf<\/p>\n<p>Add the following<\/p>\n<p>&lt;filesMatch &#8220;.(js|.css|html|txt)$&#8221;&gt;<br \/>\nSetOutputFilter DEFLATE<br \/>\n&lt;\/filesMatch&gt;<br \/>\nDeflateCompressionLevel 7<br \/>\nDeflateMemLevel 8<br \/>\nDeflateWindowSize 10<\/p>\n<p>DeflateCompressionLevel \u2013 this is the compression level applied, the default is 9, which is the highest level. The higher the compression level the more CPU it will use.<br \/>\nDeflateMemLevel \u2013 The amount of memory zlib, the compressing library can use. The default value is also 9, which is the highest.<br \/>\nDeflateWindowSize \u2013 The compression window size. By default the value is 15 which is the highest level.<\/p>\n<p>This will compress .js, .css, .html, and .txt files. Attempting to compress images will actually return a larger file size so mod_deflate only really provides an advantage on text based files.<\/p>\n<p>Once you have added the configuration settings, you would then just restart Apache to load everything in.<\/p>\n<p>service httpd restart<\/p>\n<p>That is it for adding mod_deflate to Apache.<\/p>\n<p>Jun 26, 2017LinuxAdmin.io<\/p>\n<p><a href=\"https:\/\/linuxadmin.io\/install-mod_deflate-apache\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mod_deflate is an apache module. Prior to having mod_deflate it was mod_gzip. Post apache 2.0 mod_deflate is used, it provides a slightly better compression than mod_gzip. It allows the size of certain file types to be compressed which in-turn allows clients to be able to download these files faster. This will cause the site itself &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/22\/install-mod_deflate-on-apache-linuxadmin-io\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Install mod_deflate on Apache &#8211; LinuxAdmin.io&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1175","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=1175"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1175\/revisions"}],"predecessor-version":[{"id":1267,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1175\/revisions\/1267"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=1175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=1175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=1175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}