Caching With Apache's mod_cache On Debian Etch
Caching With Apache's mod_cache On Debian EtchVersion 1.0 This article explains how you can cache your web site contents with Apache's mod_cache on Debian Etch. If you have a high-traffic dynamic web site that generates lots of database queries on each request, you can decrease the server load dramatically by caching your content for a few minutes or more (that depends on how often you update your content). I do not issue any guarantee that this will work for you!
1 Preliminary NoteI'm assuming that you have a working Apache2 setup (Apache 2.2.x - prior to that version, mod_cache is considered experimental) from the Debian repositories - the Apache version in the Debian Etch repositories is 2.2.3 so you should be good to go. I'm using the document root /var/www here for my test vhost - you must adjust this if your document root differs.
2 Enabling mod_cachemod_cache has two submodules that manage the cache storage, mod_disk_cache (for storing contents on the hard drive) and mod_mem_cache (for storing contents in memory which is faster than disk caching). Decide which one you want to use and continue either with chapter 2.1 (mod_disk_cache) or 2.2 (mod_mem_cache).
2.1 mod_disk_cacheThe mod_disk_cache configuration is stored in /etc/apache2/mods-available/disk_cache.conf, so let's edit that one: vi /etc/apache2/mods-available/disk_cache.conf Make sure you uncomment the CacheEnable disk / line, so that the minimal configuration looks as follows:
You can find explanations for these configuration options and further configuration options on http://httpd.apache.org/docs/2.2/mod/mod_disk_cache.html. Now we can enable mod_cache and mod_disk_cache: a2enmod cache /etc/init.d/apache2 force-reload To make sure that our cache directory /var/cache/apache2/mod_disk_cache doesn't fill up over time, we have to clean it with the htcacheclean command. That command is part of the apache2-utils package which we install as follows: apt-get install apache2-utils Afterwards, we can start htcacheclean as a daemon like this: htcacheclean -d30 -n -t -p /var/cache/apache2/mod_disk_cache -l 100M -i This will clean our cache directory every 30 minutes and make sure that it will not get bigger than 100MB. To learn more about htcacheclean, take a look at man htcacheclean Of course, you don't want to start htcacheclean manually each time you reboot the server - therefore we edit /etc/rc.local... vi /etc/rc.local ... and add the following line to it, right before the exit 0 line:
This will start htcacheclean automatically each time you start the server.
|
www.seamlessenterprise.com
One number. One voicemail. Seize the lead. Sprint Mobile Integration.
www.seamlessenterprise.com
One Number. One Voicemail.
Make it easier for clients to reach you. Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com
One number. One voicemail. Sprint Mobile Integration.
www.seamlessenterprise.com
One number. one voicemail. Seize the lead with Sprint. Learn more
AT&T Synaptic Compute as a Service. Boost your power on demand.
Trial: IBM Cognos Express Reporting, Analysis & Planning
Learn benefits of Simpana software.
View the Gartner Video
Sprint 4G - The Ultimate Mobile Broadband
Click here
SAP-Business Objects Crystal Reports Server
Complete reporting without hidden costs. Free Trial




print: 

Recent comments
20 hours 49 min ago
1 day 34 min ago
1 day 5 hours ago
1 day 8 hours ago
2 days 12 hours ago
2 days 13 hours ago
2 days 13 hours ago
2 days 13 hours ago
2 days 13 hours ago
2 days 21 hours ago