{"id":2844,"date":"2014-04-13T15:44:25","date_gmt":"2014-04-13T15:44:25","guid":{"rendered":"http:\/\/blog.shineservers.com\/?p=2844"},"modified":"2014-04-13T15:44:25","modified_gmt":"2014-04-13T15:44:25","slug":"increase-page-load-speed-apache-mod_deflate","status":"publish","type":"post","link":"https:\/\/www.shineservers.com\/2014\/04\/13\/increase-page-load-speed-apache-mod_deflate\/","title":{"rendered":"How To Increase Page Load Speed with Apache mod_deflate"},"content":{"rendered":"<p>Apache\u2019s mod_deflate is an Apache module that will compress output from your server before it is sent to the client. If you have newer version of Apache the mod_deflate module is probably loaded by default, but it may not be turned on. To check if compression is enabled on your site, first verify that the module is loaded in your httpd.conf file:<\/p>\n<pre>LoadModule deflate_module modules\/mod_deflate.so<\/pre>\n<p>Then you can use to following web based tool to verify compression:<\/p>\n<p><a href=\"http:\/\/www.whatsmyip.org\/http-compression-test\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">http:\/\/www.whatsmyip.org\/http-compression-test\/<\/a><\/p>\n<p>For my server, CentOS 6.x, the module was loaded by default but compression was not on until I set up the configuration file. You can place your compression configurations into your httpd.conf file, an .htaccess file, or a .conf file in your httpd\/conf.d directory. My base configuration file is as follows:<\/p>\n<pre>&lt;IfModule mod_deflate.c&gt;\n    AddOutputFilterByType DEFLATE text\/html\n    AddOutputFilterByType DEFLATE text\/plain \n    AddOutputFilterByType DEFLATE text\/css \n    AddOutputFilterByType DEFLATE text\/javascript\n    AddOutputFilterByType DEFLATE text\/xml\n&lt;\/IfModule&gt;<\/pre>\n<p>The configuration file specifies that all the html, plain, css, and javascript text files should be compressed before being sent back to the client. When writing your configuration file, you don\u2019t want to compress the images because the images are already compressed using their own specific algorithms and doubling compression just wastes CPU. Depending on the server you are running, you may want a more comprehensive compression schema based on different file types and browsers. More information can be found in the below referenced Apache docs.<\/p>\n<p>Another thing to consider is that while the gzip compression algorithm is fast and efficient for smaller text files, it can be cumbersome on your CPU when trying to compress larger files. Be wary when adding compression to non text files &gt; 50 KB.<\/p>\n<p>When you examine the HTTP headers of your server\u2019s response, you will see the following headers for compressed content:<\/p>\n<pre>Content-Encoding: gzip\nVary: Accept-Encoding<\/pre>\n<p>Here is another default configuration file taken from Ubuntu 12.10:<\/p>\n<pre>&lt;IfModule mod_deflate.c&gt;\n    # these are known to be safe with MSIE 6\n    AddOutputFilterByType DEFLATE text\/html text\/plain text\/xml    # everything else may cause problems with MSIE 6\n    AddOutputFilterByType DEFLATE text\/css\n    AddOutputFilterByType DEFLATE application\/x-javascript application\/javascript \n    AddOutputFilterByType DEFLATE application\/ecmascript\n    AddOutputFilterByType DEFLATE application\/rss+xml\n&lt;\/IfModule&gt;<\/pre>\n<p><strong>Reference<\/strong><br \/>\n<a href=\"http:\/\/httpd.apache.org\/docs\/2.2\/mod\/mod_deflate.html\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/httpd.apache.org\/docs\/2.2\/mod\/mod_deflate.html<\/a><\/p>\n<p>&nbsp;<\/p>\n<h3 class=\"zemanta-related-title\" style=\"margin: 0 0 10px 0; padding: 0; clear: both;\">Related articles across the web<\/h3>\n<ul class=\"zemanta-article-ul zemanta-article-ul-image\" style=\"margin: 0; padding: 0; overflow: hidden;\">\n<li class=\"zemanta-article-ul-li-image zemanta-article-ul-li\" style=\"padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;\"><a style=\"padding: 2px; display: block; text-decoration: none;\" href=\"http:\/\/blog.shineservers.com\/optimise-cpanelwhm-server\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" style=\"border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;\" alt=\"\" src=\"http:\/\/i.zemanta.com\/238622181_150_150.jpg\" \/><\/a><a style=\"display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;\" href=\"http:\/\/blog.shineservers.com\/optimise-cpanelwhm-server\/\" target=\"_blank\" rel=\"noopener noreferrer\">Optimise cPanel\/WHM Server<\/a><\/li>\n<li class=\"zemanta-article-ul-li-image zemanta-article-ul-li\" style=\"padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;\"><a style=\"padding: 2px; display: block; text-decoration: none;\" href=\"http:\/\/blog.shineservers.com\/use-nginx-reverse-proxy-server\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" style=\"border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;\" alt=\"\" src=\"http:\/\/i.zemanta.com\/262894551_150_150.jpg\" \/><\/a><a style=\"display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;\" href=\"http:\/\/blog.shineservers.com\/use-nginx-reverse-proxy-server\/\" target=\"_blank\" rel=\"noopener noreferrer\">How To Use Nginx As Reverse Proxy Server<\/a><\/li>\n<li class=\"zemanta-article-ul-li-image zemanta-article-ul-li\" style=\"padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;\"><a style=\"padding: 2px; display: block; text-decoration: none;\" href=\"http:\/\/moz.com\/blog\/how-to-improve-your-conversion-rates-with-a-faster-website?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+seomoz+%28SEOmoz+Daily+Blog%29\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" style=\"border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;\" alt=\"\" src=\"http:\/\/i.zemanta.com\/223041330_150_150.jpg\" \/><\/a><a style=\"display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;\" href=\"http:\/\/moz.com\/blog\/how-to-improve-your-conversion-rates-with-a-faster-website?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+seomoz+%28SEOmoz+Daily+Blog%29\" target=\"_blank\" rel=\"noopener noreferrer\">How to Improve Your Conversion Rates with a Faster Website<\/a><\/li>\n<li class=\"zemanta-article-ul-li-image zemanta-article-ul-li\" style=\"padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;\"><a style=\"padding: 2px; display: block; text-decoration: none;\" href=\"http:\/\/moz.com\/blog\/seo-your-joomla-website-in-11-super-easy-steps\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" style=\"border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;\" alt=\"\" src=\"http:\/\/i.zemanta.com\/187746202_150_150.jpg\" \/><\/a><a style=\"display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;\" href=\"http:\/\/moz.com\/blog\/seo-your-joomla-website-in-11-super-easy-steps\" target=\"_blank\" rel=\"noopener noreferrer\">SEO Your Joomla! Website in 11 Super Easy Steps<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Apache\u2019s mod_deflate is an Apache module that will compress output from your server before it is sent to the client. If you have newer version of Apache the mod_deflate module is probably loaded by default, but it may not be turned on. To check if compression is enabled on your site, first verify that the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[60],"tags":[203],"class_list":["post-2844","post","type-post","status-publish","format-standard","hentry","category-linux","tag-apache-mod_deflate-configuration"],"acf":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts\/2844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/comments?post=2844"}],"version-history":[{"count":0,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts\/2844\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/media?parent=2844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/categories?post=2844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/tags?post=2844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}