Caching with Apache mod_proxyAuthor: Dr. Volker Liebenberg, 2008/05/22
In case of complex inquiries or high volume of requests an external caching improves the answer time behaviour of the server.
Apache 1.3
<IfModule mod_proxy.c>
ProxyRequests Off
ProxyVia On
CacheRoot "/var/cache/httpd"
CacheSize 100000
CacheGcInterval 4
CacheMaxExpire 10
CacheLastModifiedFactor 0.1
CacheDefaultExpire 8
# NoCache domain1 domain2
</IfModule>
The configuration of the VirtualHost is done in the http.conf. With confixx-Professional administered systems it is removed in the file confixx_vhost.conf. Maintenance is managed via the confixx-Professional web interface. It makes sense to apply for each web presentation an own client with dedicated domain(s). <VirtualHost 217.160.211.236:80> ServerName web4.p15135474.pureserver.info ServerAlias www.meinedomain.de.de roc-berlin.de DocumentRoot /home/www/web4/html User web4 Group ftponly ScriptAlias /cgi-bin/ /home/www/web4/html/cgi-bin/ php_admin_value open_basedir /home/www/web4/ php_admin_value upload_tmp_dir /home/www/web4/phptmp/ #RewriteEngine On #RewriteRule [s. ZMS Howto 'Apache rewrite'] </VirtualHost>
Note: The reboot of Apache is best done with: rcapache restart resp. stop|start, because then the bootscript with all parameters is used.
Apache 2.0
# /etc/apache2/mods-enabled/proxy.conf #
<IfModule mod_proxy.c>
ProxyRequests Off
<Proxy *>
AddDefaultCharset off
Order deny,allow
Deny from all
ProxyFtpDirCharset UTF-8
</Proxy>
ProxyVia On
</IfModule>
# /etc/apache2/mods-enabled/disk_cache.conf # <IfModule mod_disk_cache.c> CacheRoot /var/cache/apache2/mod_disk_cache CacheDirLevels 5 CacheDirLength 3 </IfModule> # /etc/apache2/sites-enabled/httpd-mySite.conf # <Proxy *> Order allow,deny Allow from all </Proxy> <VirtualHost *> ServerName www.hermann-husen.de RewriteEngine On RewriteRule ... CacheEnable disk / CacheRoot /path-to-MySite/proxycache CacheDirLevels 2 CacheDirLength 1 CacheIgnoreNoLastMod On CacheDefaultExpire 3600 </VirtualHost>
ZMS templates
The modifcation of ZMS templates is minimal. It must be made sure only that pages contain the needed information for caching in the header. This can be achieved by entry of the following DTML methods: <dtml-if "REQUEST.get('preview','')=='preview' or (getObjProperty('attr_cacheable', REQUEST)==0)"
><dtml-call "RESPONSE.setHeader('Expires', '-1')"
><dtml-call "RESPONSE.setHeader('Cache-Control', 'no-cache')"
><dtml-call "RESPONSE.setHeader('Pragma', 'no-cache')"
><dtml-else><dtml-call "RESPONSE.setHeader('Expires', _.DateTime(_.DateTime().timeTime() + 86400).toZone('GMT').rfc822())"
><dtml-call "RESPONSE.setHeader('Last-Modified', bobobase_modification_time().toZone('GMT').rfc822())"
><dtml-call "RESPONSE.setHeader('If-Modified-Since', bobobase_modification_time().toZone('GMT').rfc822())"
><dtml-call "RESPONSE.setHeader('Cache-Control', 'proxy-revalidate')"
></dtml-if>
If the internal control of the caching mechanism shall be considered, the condition for
Pages beyond the Preview are marked as follows:
It is recomended to apply a template "cache_config" and to call it in the master template (standard_html_header) as well as in the stylesheet resp. possible script templates per "<dtml-var cache_config>".
Virtual Host Monster
If several domains shall be maintained within a ZOPE instance, a rewriting of requests is needed. This is taken over within ZOPE by the products SiteAccess or Virtual Host Monster (VHM). More about the topic: |
Home |
Sitemap |
Printversion |
Top |
Imprint |
pressinfo
© 2001-2008 Hoffmann+Liebenberg GmbH, SNTL Publishing GmbH & Co KG
|
ZMS is a partner project of medvalue.net