mod_cache.xml revision fc3182e72cf0679cbf14a95213fbb9a98c3cf597
12b42c76672a66c2d4ea7212c14f8f1b5a62b78dTom Gundersen<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
c91faef3b3facfdf13282aee957af25dd555890bLennart Poettering<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
c91faef3b3facfdf13282aee957af25dd555890bLennart Poettering<!-- $LastChangedRevision$ -->
c91faef3b3facfdf13282aee957af25dd555890bLennart Poettering Licensed to the Apache Software Foundation (ASF) under one or more
c91faef3b3facfdf13282aee957af25dd555890bLennart Poettering contributor license agreements. See the NOTICE file distributed with
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering this work for additional information regarding copyright ownership.
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering The ASF licenses this file to You under the Apache License, Version 2.0
c91faef3b3facfdf13282aee957af25dd555890bLennart Poettering (the "License"); you may not use this file except in compliance with
c91faef3b3facfdf13282aee957af25dd555890bLennart Poettering the License. You may obtain a copy of the License at
c91faef3b3facfdf13282aee957af25dd555890bLennart Poettering http://www.apache.org/licenses/LICENSE-2.0
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering Unless required by applicable law or agreed to in writing, software
c91faef3b3facfdf13282aee957af25dd555890bLennart Poettering distributed under the License is distributed on an "AS IS" BASIS,
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
c91faef3b3facfdf13282aee957af25dd555890bLennart Poettering See the License for the specific language governing permissions and
c91faef3b3facfdf13282aee957af25dd555890bLennart Poettering limitations under the License.
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek<modulesynopsis metafile="mod_cache.xml.meta">
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek<description>Content cache keyed to URIs.</description>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek<sourcefile>mod_cache.c</sourcefile>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek<identifier>cache_module</identifier>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <note type="warning">This module should be used with care and
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek can be used to circumvent <directive
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek module="mod_authz_host">Allow</directive> and <directive
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek module="mod_authz_host">Deny</directive> directives. You
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek should not enable caching for any content to which you wish
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek to limit access by client host name, address or environment
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek variable.</note>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <p><module>mod_cache</module> implements an <a
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> compliant HTTP
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek content cache that can be used to cache either local or proxied content.
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <module>mod_cache</module> requires the services of one or more storage
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek management modules. Two storage management modules are included in
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek the base Apache distribution:</p>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <dt><module>mod_disk_cache</module></dt>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <dd>implements a disk based storage manager.</dd>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <dt><module>mod_mem_cache</module></dt>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <dd>implements a memory based storage manager.
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <module>mod_mem_cache</module> can be configured to operate in two
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek modes: caching open file descriptors or caching objects in heap storage.
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <module>mod_mem_cache</module> can be used to cache locally generated content
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek or to cache backend server content for <module>mod_proxy</module> when
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek configured using <directive module="mod_proxy">ProxyPass</directive>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek (aka <dfn>reverse proxy</dfn>)</dd>
3ba3a79df4ae094d1008c04a9af8d1ff970124c4Zbigniew Jędrzejewski-Szmek <p>Content is stored in and retrieved from the cache using URI based keys. Content with
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek access protection is not cached.</p>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <p>Further details, discussion, and examples, are provided in the
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <a href="/caching.html">Caching Guide</a>.</p>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek<seealso><a href="/caching.html">Caching Guide</a></seealso>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek<section id="related"><title>Related Modules and Directives</title>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <directive module="mod_disk_cache">CacheRoot</directive>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <directive module="mod_disk_cache">CacheDirLevels</directive>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <directive module="mod_disk_cache">CacheDirLength</directive>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <directive module="mod_disk_cache">CacheMinFileSize</directive>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <directive module="mod_disk_cache">CacheMaxFileSize</directive>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <directive module="mod_mem_cache">MCacheSize</directive>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <directive module="mod_mem_cache">MCacheMaxObjectCount</directive>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <directive module="mod_mem_cache">MCacheMinObjectSize</directive>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <directive module="mod_mem_cache">MCacheMaxObjectSize</directive>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <directive module="mod_mem_cache">MCacheRemovalAlgorithm</directive>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <directive module="mod_mem_cache">MCacheMaxStreamingBuffer</directive>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek </directivelist>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek<section id="sampleconf"><title>Sample Configuration</title>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <example><title>Sample httpd.conf</title>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek # Sample Cache Configuration<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek LoadModule cache_module modules/mod_cache.so<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <IfModule mod_cache.c><br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek #LoadModule disk_cache_module modules/mod_disk_cache.so<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek # If you want to use mod_disk_cache instead of mod_mem_cache,<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek # uncomment the line above and comment out the LoadModule line below.<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <IfModule mod_disk_cache.c><br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek CacheRoot c:/cacheroot<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek CacheEnable disk /<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek CacheDirLevels 5<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek CacheDirLength 3<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek </IfModule> <br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek LoadModule mem_cache_module modules/mod_mem_cache.so<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <IfModule mod_mem_cache.c><br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek CacheEnable mem /<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek MCacheSize 4096<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek MCacheMaxObjectCount 100<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek MCacheMinObjectSize 1<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek MCacheMaxObjectSize 2048<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek </IfModule><br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek # When acting as a proxy, don't cache the list of security updates<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek CacheDisable http://security.update.server/update-list/<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek </IfModule>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek<directivesynopsis>
9407bc2d03b6405754807b6f38c8ca95b4fc1f40Zbigniew Jędrzejewski-Szmek<description>Enable caching of specified URLs using a specified storage
9407bc2d03b6405754807b6f38c8ca95b4fc1f40Zbigniew Jędrzejewski-Szmekmanager</description>
71418295125c542d3edd1e7251bb0701ef1af89bZbigniew Jędrzejewski-Szmek<syntax>CacheEnable <var>cache_type</var> <var>url-string</var></syntax>
71418295125c542d3edd1e7251bb0701ef1af89bZbigniew Jędrzejewski-Szmek<contextlist><context>server config</context><context>virtual host</context>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <p>The <directive>CacheEnable</directive> directive instructs
71418295125c542d3edd1e7251bb0701ef1af89bZbigniew Jędrzejewski-Szmek <module>mod_cache</module> to cache urls at or below
71418295125c542d3edd1e7251bb0701ef1af89bZbigniew Jędrzejewski-Szmek <var>url-string</var>. The cache storage manager is specified with the
71418295125c542d3edd1e7251bb0701ef1af89bZbigniew Jędrzejewski-Szmek <var>cache_type</var> argument. <var>cache_type</var> <code> mem</code>
9407bc2d03b6405754807b6f38c8ca95b4fc1f40Zbigniew Jędrzejewski-Szmek instructs <module>mod_cache</module> to use the memory based storage
9407bc2d03b6405754807b6f38c8ca95b4fc1f40Zbigniew Jędrzejewski-Szmek manager implemented by <module>mod_mem_cache</module>.
b938cb902c3b5bca807a94b277672c64d6767886Jan Engelhardt <var>cache_type</var> <code>disk</code> instructs
9407bc2d03b6405754807b6f38c8ca95b4fc1f40Zbigniew Jędrzejewski-Szmek <module>mod_cache</module> to use the disk based storage manager
9407bc2d03b6405754807b6f38c8ca95b4fc1f40Zbigniew Jędrzejewski-Szmek implemented by <module>mod_disk_cache</module>.
9407bc2d03b6405754807b6f38c8ca95b4fc1f40Zbigniew Jędrzejewski-Szmek <var>cache_type</var> <code>fd</code> instructs
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <module>mod_cache</module> to use the file descriptor cache implemented
71418295125c542d3edd1e7251bb0701ef1af89bZbigniew Jędrzejewski-Szmek by <module>mod_mem_cache</module>.</p>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <p>In the event that the URL space overlaps between different
9407bc2d03b6405754807b6f38c8ca95b4fc1f40Zbigniew Jędrzejewski-Szmek <directive>CacheEnable</directive> directives (as in the example below),
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek each possible storage manager will be run until the first one that
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek actually processes the request. The order in which the storage managers are
7284335adbb8cb2bc9c11f9e102906da1bf71145Zbigniew Jędrzejewski-Szmek run is determined by the order of the <directive>CacheEnable</directive>
9407bc2d03b6405754807b6f38c8ca95b4fc1f40Zbigniew Jędrzejewski-Szmek directives in the configuration file.</p>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek CacheEnable mem /manual<br />
c91faef3b3facfdf13282aee957af25dd555890bLennart Poettering CacheEnable fd /images<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek CacheEnable disk /<br />
7284335adbb8cb2bc9c11f9e102906da1bf71145Zbigniew Jędrzejewski-Szmek <p>When acting as a forward proxy server, <var>url-string</var> can
9407bc2d03b6405754807b6f38c8ca95b4fc1f40Zbigniew Jędrzejewski-Szmek also be used to specify remote sites and proxy protocols which
9407bc2d03b6405754807b6f38c8ca95b4fc1f40Zbigniew Jędrzejewski-Szmek caching should be enabled for.</p>
9407bc2d03b6405754807b6f38c8ca95b4fc1f40Zbigniew Jędrzejewski-Szmek # Cache proxied url's<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek # Cache FTP-proxied url's<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek CacheEnable disk ftp://<br /><br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek # Cache content from www.apache.org<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek CacheEnable disk http://www.apache.org/<br />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek</directivesynopsis>
3ba3a79df4ae094d1008c04a9af8d1ff970124c4Zbigniew Jędrzejewski-Szmek<directivesynopsis>
3ba3a79df4ae094d1008c04a9af8d1ff970124c4Zbigniew Jędrzejewski-Szmek<description>Disable caching of specified URLs</description>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek<syntax>CacheDisable <var> url-string</var></syntax>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek<contextlist><context>server config</context><context>virtual host</context>
<description>The default duration to cache a document when no expiry date is specified.</description>