YSlow & Improving Speed

Yahoo! came out with a FireBug addon - YSlow, that takes a look at your web page and offers a score on performance. Most of the recommendations are easy enough to follow, below are 3 that take some Apache httpd.conf hacking to get working:

1) Configure ETags

Add this to your httpd.conf

FileETag MTime Size

 

2) Turn on Expiration Headers

# Turn on Expires and set default to 0

ExpiresActive On

ExpiresDefault A7200

 

# Set up caching on media files for 1 year

<FilesMatch “\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$”>

ExpiresDefault A29030400

</FilesMatch>

 

# Set up caching on media files for 1 week

<FilesMatch “\.(gif|jpg|jpeg|png|swf)$”>

ExpiresDefault A604800

</FilesMatch>

 

# Set up 24 Hour caching on commonly updated files

<FilesMatch “\.(xml|txt|html|php|js|css)$”>

ExpiresDefault A86400

</FilesMatch>

 

3) Add Gzip compression

Install mod_gzip for Apache, add this to your httpd.conf to configure mod_gzip to handle files/settings

<IfModule mod_gzip.c>

 mod_gzip_on Yes

mod_gzip_can_negotiate Yes

mod_gzip_static_suffix .gz

AddEncoding gzip .gz

mod_gzip_update_static No

mod_gzip_command_version ‘/mod_gzip_status’

mod_gzip_keep_workfiles No

mod_gzip_minimum_file_size 512

mod_gzip_maximum_file_size 1048576

mod_gzip_maximum_inmem_size 60000

mod_gzip_min_http 1000

mod_gzip_handle_methods GET POST

 

mod_gzip_item_include mime ^text/.*

mod_gzip_item_include mime ^httpd/unix-directory$

mod_gzip_item_include file \.shtml$

mod_gzip_item_include file \.html$

mod_gzip_item_include mime ^application/x-javascript$

mod_gzip_item_include mime ^application/javascript$

mod_gzip_item_include file \.js$

mod_gzip_item_include file \.css$

mod_gzip_item_include mime ^application/x-httpd-php$

mod_gzip_item_include file \.php$

mod_gzip_item_include handler ^cgi-script$

 

mod_gzip_dechunk Yes

 

# DO NOT WASTE TIME COMPRESSING IMAGES

mod_gzip_item_exclude mime ^image/.$

mod_gzip_item_exclude mime ^image/

mod_gzip_item_exclude rspheader Content-Type:image/*

</IfModule>

 That’s it, those 3 changes improved my score from F (60) to a respectable B (81).

image

Written by Tim on August 16th, 2007 with 3 comments.
Read more articles on unix and web 2.0 ish.



Related articles

3 comments

Read the comments left by other users below, or:

Get your own gravatar by visiting gravatar.com best mens A.Dunhill watches
#1. May 27th, 2011, at 3:31 AM.

nice post!!!!!thankk you for sharing!!!!!

Get your own gravatar by visiting gravatar.com Griffey Shoes
#2. August 15th, 2011, at 1:48 AM.

Thank you for the article, I saw after the enlightened, my idea like you, just not good at expression

Get your own gravatar by visiting gravatar.com jack wills
#3. September 24th, 2011, at 11:22 AM.

Many thanks for being the teacher on this niche. I actually enjoyed your own article quite definitely and most of all enjoyed reading how you really handled the areas I considered to be controversial. You are always extremely kind to readers like me and help me in my life.

Leave your comment...

If you want to leave your comment on this article, simply fill out the next form:




Anti-Spam Protection by WP-SpamFree

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> .

Famous Homemade Soups