But in the real world enabling GZIP on your existing infrastructure is more complicated then you think and you might want to enable log for what is getting zipped and what is not. you can add following lines to your httpd.conf
DeflateFilterNote ratio
LogFormat '"%r" %b (%{ratio}n) "%{User-agent}i"' deflate
CustomLog logs/deflate_log deflate
<Location />
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</Location>
Once that is done the mod_deflate will start writing logs about every request and write information about what all responses were zipped and the compression ration
"GET /wpcert/demo HTTP/1.1" 20 (-) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wpcert/demo HTTP/1.1" 4878 (28) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wpcert/menu/menu_service.js HTTP/1.1" 3519 (32) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wpcert/peopleawareness/personQ_ns6.js HTTP/1.1" 28436 (23) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wpcert/dnd/DND.js HTTP/1.1" 14742 (19) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wpcert/skins/html/ThinSkin/title_minheight.gif HTTP/1.1" 63 (-) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wpcert/themes/html/Portal/images/topNav/menu_selected_disabled.gif HTTP/1.1" 825 (-) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /portal_dojo/dijit/themes/tundra/tundra.css HTTP/1.1" 10962 (17) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wpcert/images/icons/ClearPixel.gif HTTP/1.1" 49 (-) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wps_semanticTag/javascript/semanticTagService.js?language=en HTTP/1.1" 19861 (26) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wpcert/themes/html/css/dojo.css HTTP/1.1" 1854 (27) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wpcert/themes/html/css/dojoTheme.css HTTP/1.1" 1828 (24) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wpcert/themes/html/Portal/images/ExpandPalette.gif HTTP/1.1" 208 (-) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wpcert/themes/html/Portal/images/Portal.ico HTTP/1.1" 883 (61) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wpcert/themes/html/Portal/images/CollapsePalette.gif HTTP/1.1" 911 (-) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wpcert/themes/html/css/core.css HTTP/1.1" 16027 (21) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
"GET /wpcert/themes/html/css/defaultTheme.css HTTP/1.1" 8250 (19) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
Take a closer look at this line
"GET /wpcert/menu/menu_service.js HTTP/1.1" 3519 (32) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
The /wpcert/menu/menu_service.js is 10925 bytes by default but once you enable zip this file is getting zipped to 3519 bytes so the compression ration is 3.1. You can see the number of bytes after zipping and the compression ration in the log line
On my local i configured HTTP server not to gzip binary files such as images, pdfs,.. etc. So whenever mod_deflate receives request for binary file it will skip it, take a look at this line
"GET /wpcert/themes/html/Portal/images/ExpandPalette.gif HTTP/1.1" 208 (-) "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"
This means the image is 208 bytes in size and
(-)
indicates that image was not zipped
1 comment:
Thanks for info....
SEO Company in Bangalore
Post a Comment