Thursday, February 15, 2007

Optimizing Apache install

Sometimes it's necessary to speedup page load times in Apache.
I had a problem with phpfox loading to the clients too slowly.

What I've done to the default Apachw2 install?


Find in config file (httpd.conf) this line
KeepAlive Off
and change to
KeepAlive On

This will turn on keep-alives (making several HTTP requests thru single tcp connectoin) and will save some time on pages which have lots of elements to load (pictures, css, javascript files and etc).


Turn on mod_defalte:
* Make sure, that mod_deflate is loaded -- this line should be uncommented in the config file
LoadModule deflate_module modules/mod_deflate.so
* Turn on compression for necessary virtual host directory or location.
The following example shows how to turn on compression in Location directive



<Location />
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-javascript text/css
</Location>



This will compress served text files only -- html, javascript and css. But this is also enough to make page load much more faster. You will feel this on phpfox, phpbb or some another heavy software.

No comments: