Apache Cache with multiple CacheRoots

Posted by Tobias Greitzke on Server Fault See other posts from Server Fault or by Tobias Greitzke
Published on 2012-07-01T12:13:22Z Indexed on 2012/07/01 15:17 UTC
Read the original article Hit count: 144

Filed under:
|
|

I configured Apache with a CacheRoot directory for each of my domains / virtual hosts:

<VirtualHost>
ServerName domain1.tld
...
CacheRoot /var/www/vhosts/domain1.tld/httpdocs/cache
...
</VirtualHost>

<VirtualHost>
ServerName domain2.tld
...
CacheRoot /var/www/vhosts/domain2.tld/httpdocs/cache
...
</VirtualHost>

I have this up and running for quite a while and so fare it's working pretty well except that I have to empty out the cache manually every so often because htcacheclean does't know of the different directories.

Now I would like to setup htcacheclean to watch over the cache directories but as fare as I understand the manual, I can only set it to one cache directory. I would like to do something like this but that doesn't work:

<VirtualHost>
ServerName domain1.tld
...
CacheRoot /var/www/vhosts/domain1.tld/httpdocs/cache
    htcacheclean -n -t -p/var/www/vhosts/domain1.tld/httpdocs/cache -l1024M
...
</VirtualHost>

Is it even right to have multiple cache directorys or should I work with just one cache directory for all of the domains?

© Server Fault or respective owner

Related posts about apache2

Related posts about virtualhost