{"id":262,"date":"2011-03-03T20:42:01","date_gmt":"2011-03-03T20:42:01","guid":{"rendered":"https:\/\/kari.world.ikari.fi\/2011\/03\/03\/running-with-breaks-on\/"},"modified":"2011-03-03T20:42:01","modified_gmt":"2011-03-03T20:42:01","slug":"running-with-breaks-on","status":"publish","type":"post","link":"https:\/\/kari.world.ikari.fi\/?p=262","title":{"rendered":"Running with breaks on"},"content":{"rendered":"<p>While not being expert in web server maintenance it came as surprise to me that seemingly still in year 2011 default configuration of apache2 (nor tomcat6) isn&#8217;t enabling compression by default. Instead some manual tweaking is required.<\/p>\n<p>So steps are:<\/p>\n<p><strong>Step 1:<\/strong><br \/>\n[code]<br \/>\nvim \/etc\/sysconfig\/apache2<br \/>\n[\/code]<\/p>\n<p>Append following into file<br \/>\n[code]<br \/>\nAPACHE_MODULES=&#8221;&#8230; jk deflate&#8221;<br \/>\nvim \/etc\/apache2\/vhosts.d\/your-vhost.conf<br \/>\n[\/code]<\/p>\n<p><strong>Step 2:<\/strong><br \/>\nWe are not yet done<br \/>\n[code]<br \/>\nvim \/etc\/apache2\/vhosts.d\/your-vhost.conf<br \/>\n[\/code]<\/p>\n<p>And add following block into file<br \/>\n[code]<br \/>\n    <Location \/><br \/>\n        SetOutputFilter DEFLATE<br \/>\n        BrowserMatch ^Mozilla\/4\\.0[678] no-gzip<br \/>\n        BrowserMatch \\bMSI[E] !no-gzip !gzip-only-text\/html<br \/>\n        # Don&#8217;t compress images<br \/>\n        SetEnvIfNoCase Request_URI \\.(?:gif|jpe?g|png)$ no-gzip dont-vary<br \/>\n    <\/Location><br \/>\n[\/code]<\/p>\n<p>Repeat that for all vhosts.<\/p>\n<p><strong>Step 3:<\/strong><br \/>\nAnd finally restart apache<br \/>\n[code]<br \/>\n\/etc\/init.d\/apache2 restart<br \/>\n[\/code]<\/p>\n<p><strong>Step 4:<\/strong><br \/>\nAnd test if compression is now working<\/p>\n<p><a href=\"http:\/\/www.gidnetwork.com\/tools\/gzip-test.php\">GZip compression test<\/a><\/p>\n<p><strong>Done,,, for Apache2 part<\/strong><\/p>\n<p>Then lets attack tomcat6<br \/>\n&#8230;<\/p>\n<p><strong>Step 1:<\/strong><br \/>\nEnable compression in config file<br \/>\n[code]<br \/>\nvim \/opt\/tomcat6\/conf\/server.xml<br \/>\n[\/code]<\/p>\n<p>This should to the trick<br \/>\n[code]<br \/>\n    <Connector port=\"8080\" protocol=\"HTTP\/1.1\"\n               connectionTimeout=\"20000\"\n               redirectPort=\"8443\"\n               compression=\"on\"\n               compressionMinSize=\"2048\"\n               compressableMimeType=\"text\/css,text\/html,text\/xml,text\/javascript\" \/><br \/>\n    &#8230;.<br \/>\n    <Connector port=\"8009\" protocol=\"AJP\/1.3\" redirectPort=\"8443\"\n               compression=\"on\"\n               compressionMinSize=\"2048\"\n               compressableMimeType=\"text\/css,text\/html,text\/xml,text\/javascript\" \/><br \/>\n[\/code]<\/p>\n<p><strong>Step 2:<\/strong><br \/>\nRestart server<br \/>\n[code]<br \/>\n\/opt\/tomcat6\/bin\/catalina.sh stop<br \/>\n\/opt\/tomcat6\/bin\/catalina.sh start<br \/>\n[\/code]<\/p>\n<p><strong>References:<\/strong><br \/>\n<a href=\"http:\/\/crazytoon.com\/2008\/05\/29\/apache-gzip-compression-how-do-i-speed-up-my-website-download-time\/\">Apache2 gzip compression: How do I speed up my website download time?<\/a><br \/>\n<a href=\"http:\/\/viralpatel.net\/blogs\/2008\/11\/enable-gzip-compression-in-tomcat.html\">Enable GZIP compression in tomcat<\/a><br \/>\n<a href=\"http:\/\/www.gidnetwork.com\/tools\/gzip-test.php\">GZip compression test<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>While not being expert in web server maintenance it came as surprise to me that seemingly still in year 2011 default configuration of apache2 (nor tomcat6) isn&#8217;t enabling compression by default. Instead some manual tweaking is required. So steps are: Step 1: [code] vim \/etc\/sysconfig\/apache2 [\/code] Append following into file [code] APACHE_MODULES=&#8221;&#8230; jk deflate&#8221; vim&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-262","post","type-post","status-publish","format-standard","hentry","category-diary"],"_links":{"self":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/posts\/262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=262"}],"version-history":[{"count":0,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/posts\/262\/revisions"}],"wp:attachment":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}