Contact Lifestream



Gzip once more …

Hmm. Seems I forgot all about it since the server move. On the old server (f2o) it was active by default if I remember correctly but on 99k it is not. It’s probably more compatible this way so the 99k admin is surely on the right track.
Anyway. For my particular site it would be stupid not to Gzip content before sending it to the browser. Especially with the more text intensive pages. With the blog it was already taken care of thanks to the Gzip plugin, however, the rest of the site needs to be souped up.
After some webcrawling I found this forum post describing a “safe” way to enable gzip and at the same time avoid server errors and obsolete browsers. All that is required are a few extra lines in your .htaccess file …

    <IfDefine HAVE_GZIP>
    AddModule mod_gzip.c
    </IfDefine>
    <IfModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_can_negotiate Yes
    AddEncoding gzip .gz
    mod_gzip_temp_dir /home/modgziptmp
    mod_gzip_keep_workfiles No
    mod_gzip_minimum_file_size 1000
    mod_gzip_maximum_file_size 0
    mod_gzip_maximum_inmem_size 100000
    mod_gzip_min_http 1000
    mod_gzip_item_exclude reqheader “User-agent: Mozilla/4.0[678]”
    mod_gzip_item_include file \.htm$
    mod_gzip_item_include file \.html$
    mod_gzip_item_include file \.shtml$
    mod_gzip_item_include file \.php$
    mod_gzip_item_include file \.phtml$
    mod_gzip_item_include file \.jsp$
    mod_gzip_item_include file \.pl$
    mod_gzip_item_include file \.css$
    mod_gzip_item_include file \.txt$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/html$
    mod_gzip_item_include mime ^text/plain$
    mod_gzip_item_include mime ^httpd/unix-directory$
    mod_gzip_item_exclude mime ^image/
    mod_gzip_dechunk Yes
    mod_gzip_add_header_count Yes
    </IfModule>

The only problem is that it doesn’t work on my server. Why I do not know. Fortunately I use PHP so I can call upon ob_start( ‘ob_gzhandler’ ); that DOES work. It is also the way that Nucleus forces its gzip coding. I don’t see any real downside to this method even if the .htaccess way of doing things is of course preferred.
I’m a bit puzzled by user reports of search engine refusals though. As I said I used to have gzip activated (mod_gzip) on the old server by default and with no problems. I guess that setting supersedes the use of the internal php gzip handler? Maybe there is a connection between the recent drop of this site from Google’s database and the use of ob_gzhandler .. ? Or at least some sort of script error related to this.
Alternatively, it is in fact so that Google has changed its policy regarding blogs and the amount of cross linkage that they produce.

Anyway. Back to the issue of GZIP. I found that the gzip test is a good measure to tell if you can benefit from activating gzip compression.
Using the current software list (126221 bytes) for example it’s easy to slice the download time to about one sixth of the original value. On a 10kb/s pipe you get 2.5 s instead of 12 s. And while most broadband users have vastly more bandwidth to waste, the server might not or the route to the server might be throttled somehow. An even better site with before and after results can be found here.



OpenDNS

Use OpenDNS

Worthy Causes