Apache Speed Tips

by mikechiu

Good site for optimizing Apache for speed: http://www.askapache.com/htaccess/apache-speed-expires.html

 

Cache Expiration

To enable cache expiration and let browsers know when to refresh your content, add the following in your httpd.conf:

LoadModule expires_module modules/mod_expires.so

 

Then add the following in your .htaccess file:

# turn on the module for this directory

ExpiresActive on

# set default

ExpiresDefault "access plus 24 hours"

ExpiresByType image/jpg "access plus 1 month"

ExpiresByType image/gif "access plus 1 month"

ExpiresByType image/jpeg "access plus 1 month"

ExpiresByType image/png "access plus 1 month"

ExpiresByType text/css "access plus 1 week"

ExpiresByType text/javascript "access plus 1 week"

ExpiresByType application/javascript "access plus 1 week"

ExpiresByType application/x-shockwave-flash "access plus 1 month"

 

By default, this will make all your stuff expire 24 hours after someone accesses your site. Adjust the times as necessary.

Categories
Updated May 31, 2010