Caching setup using Apache 2.0

by Alex Limi last modified Dec 30, 2008 03:04 PM
How to set up the caching using Apache 2.0.

The major differences from Limi's instructions on Apache 1.3 were:

- In order to get apache proxying the requests the following line needs to be uncommented in the httpd.conf::

LoadModule proxy_http_module modules/mod_proxy_http.so

- The following modules are also needed to get the caching working. They may not appear in your httpd.conf so if not, you'll have to add them::

LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule cache_module modules/mod_cache.so

- The following setting in httpd.conf file was not enough::

CacheRoot "/var/cache/artpropensity.com"

It must be proceeded by: 'CacheEnable disk /'

so that it looks like::

CacheEnable disk /
CacheRoot "/var/cache/artpropensity.com"

- I also had to set explicit IP's and hosts in my /etc/hosts file, as
in::

192.168.10.10 www.artpropensity.com artpropensity.com

This is so that the following settings in the httpd.conf file will
get resolved properly::

ProxyPass / http://www.artpropensity.com:9080/VirtualHostBase/http/www.artpropensity.com:80/artpropensity/VirtualHostRoot/
ProxyPassReverse / http://www.artpropensity.com:9080/VirtualHostBase/http/www.artpropensity.com:80/artpropensity/VirtualHostRoot/


- Using "wget -sS ..." as command line also did not work for me. I
ended up running a browser on an external server using X-windows. I set the
browser to no-cache (check for new page each time) to make sure that it did
not cache items and instead made a full request to Apache each time it
accessed the site. I also used your advice and performed::

$ tail -f Z2.log

to make sure that Plone was not serving up .js, .css, .gif, etc. and
instead Apache was serving them up once cached. I did notice 304's on some
items, but I assume that's because the browser was set to no-cache and it
forced Apache to check with Plone to see if the file had changed.

**I noticed a speed increase from 4 requests/sec to an average of 300 using Apache 2 caching**