Monday, September 5, 2011

Configure Apache

We can use apache to serve static resource; infact apache is meant for this. Apache can cache data so that accessing resources is very quick. Proxy pass is the best way to do this.

<VirtualHost *:80>
ServerAdmin abc@y.com
DocumentRoot /root/cacheContent
<IfModule rewrite_module>
RewriteLog logs/rewrite.log
RewriteLogLevel 3
</IfModule>

ProxyRequests off
ProxyPass /context/css/ !
ProxyPass /context/ http://10.10.11.176:8080/backendContext/
ProxyPassReverse /context/ http://10.10.11.176:8080/backendContext/

CacheEnable disk /
CacheEnable mem /

<IfModule mod_cache.c>
<IfModule mod_disk_cache.c>
CacheRoot /root/cacheContent/
CacheEnable disk /
</IfModule>
</IfModule>

</VirtualHost>

So this is how it works. When ever u get /context on this ip send it to 10.10.11.176/backendContext. When ever u have static resources dont get it from the bakendContext. So in this case it gets it from /root/cacheContext/.

No comments:

Post a Comment