Forum Moderators: phranque

Message Too Old, No Replies

mod cache in a proxy apache

         

erlguta

10:30 am on Oct 21, 2011 (gmt 0)

10+ Year Member



Hi.
I am trying to enable mod_cache in one apache in ubuntu-server (2.2.14) that acts like a proxy
for another apaches.
What i did is edit the config file of the apache that acts as a proxy /etc/apache2/mods-available/mem_cache.conf with:

<IfModule mod_mem_cache.c>
CacheEnable mem /
MCacheSize 4096
MCacheMaxObjectCount 100
MCacheMinObjectSize 1
MCacheMaxObjectSize 2048
</IfModule>

and enable modules and restart apache:
# a2enmod cache
# a2enmod mem_cache
# /etc/init.d/apache2 restart

Is this enough?...to sepecify it only in the apache-proxy config file: /etc/apache2/mods-available/mem_cache.conf for all the proxy apaches to start being cahed? Or should I define this config per virtualhost?

For example, in /etc/apache2/sites-available/webserver1:

<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / [192.168.X.XX...]
ProxyPassReverse / [192.168.X.XX...]
ServerName blabla.com
</VirtualHost>

<IfModule mod_mem_cache.c>
CacheEnable mem /
MCacheSize 4096
MCacheMaxObjectCount 100
MCacheMinObjectSize 1
MCacheMaxObjectSize 2048
</IfModule>

- in /etc/apache2/sites-available/webserver2:

<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / [192.168.X.XX...]
ProxyPassReverse / [192.168.X.XX...]
ServerName blabla.com
</VirtualHost>

<IfModule mod_mem_cache.c>
CacheEnable mem /
MCacheSize 4096
MCacheMaxObjectCount 100
MCacheMinObjectSize 1
MCacheMaxObjectSize 2048
</IfModule>

etc, etc.

Thank you

Gonzalo