How to use deflate in apache config to save bandwidth on webserver

How to save some bandwidth on webserver with deflate..?
my blog now having some sort of heavy usage due to multiple shared hosting package that i’m currently parked..

Found 380 domains hosted on the same web server as namran.net (210.48.152.20).

It appears that the web server located at 210.48.152.20 may be hosting one or more web sites with explicit content. The web sites in question are highlighted in red below. There is a possibility that all of the web sites on this web server may be blocked by web filtering software. Search engine rankings for these web sites may be affected as well.

not having a lot of money to throw in ( move to another package..)
so i have to stick around.. luckily got some optimization option could be done via cPanel itself..
and for mirroring part.. have to do it myself.. assume you had access to /etc/httpd/conf/httpd.conf

After being sometime referring to yahoo Yslow ..
one of the key component is to apply gzip function on css and javascript file..
which haven’t changed that much..

But if want to apply it on all html/text .. but not to images file..
I use the following httpd config..


<VirtualHost *:80>
ServerName blog.namran.net
DocumentRoot "/var/www/html/blog"
DirectoryIndex index.php
# Deflate
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
DeflateCompressionLevel 9
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
</VirtualHost>

and ..

<Directory "/var/www/html/blog">
# 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
Order allow,deny
Allow from all
AllowOverride All
</Directory>

then have to restart the webserver to apply..

I think can also be applied with the .htaccess file though..

References :

1. http://developer.yahoo.com/yslow/faq.html
2. www.howtoforge.com/apache2_mod_deflate
3. http://www.yougetsignal.com/tools/web-sites-on-web-server/

p/s : small saving of bandwidth with something not so difficult to implement.. 8-)

Namran Hussin

Leave a Comment
Share
Published by
Namran Hussin

Recent Posts

How you can speak with clarity and influence

Here are five key communication skills that help you speak with clarity and influence: Speak…

7 months ago

? Man360 Academy Q&A Session Video Access – Empower Your Masculine Growth Journey

Are you ready to unlock your full potential as a man?Discover powerful insights, real-life transformations,…

1 year ago

A note to remember

One day we will set aside one whole day to review the whole lesson we…

1 year ago

Dev Fest KL 2024

Last weekend, 07/12/2024 I managed to join Dev Fest Kuala Lumpur 2024, organized by Google…

1 year ago

TIPS BACAAN AL-QURAN

TIPS BACAAN AL-QURANOleh: Dr. Muhd al-Muhaysni.1. Jangan engkau berikan (fokus membaca) al-Quran pada lebihan waktumu…

2 years ago

Selawat 300 ribu kali

Selawat yang ringkas, yang mana apabila kamu membacanya satu kali sebanding 100 ribu kali, jadi…

2 years ago