Minimal configuration is required to set up the depot server behind a caching proxy. With the exception of the catalog attributes file (see Cache Considerations for the Catalog Attributes File) and repository search results (see Cache Considerations for Search), all files served are unique and therefore safe to cache indefinitely if necessary. Also, all depot responses contain the appropriate HTTP headers to ensure files in the cache do not become stale by mistake.
See the Apache Caching Guide for more information about configuring Apache as a caching proxy.
Use the CacheRoot directive to specify the directory to contain the cached files. Make sure the specified directory is writable by the Apache process. No explicit error message is output if Apache cannot write to this directory.
Apache allows you to enable caching for specific directories. You probably want your repository server to cache all of the content on the server, as shown in the following directive.
CacheEnable disk /
Use the CacheMaxFileSize directive to set the maximum size of files to be cached. The Apache default of 1 MB might be too small for most repositories. The following directive sets the maximum cached file size to 1 GB.
Adjust the directory structure of the on-disk cache for the best performance with the underlying file system. In a ZFS dataset, multiple directory levels affect performance more than the number of files in one directory. Therefore, configure one directory level with a large number of files in each directory. Use the CacheDirLevels and CacheDirLength directives to control the directory structure. Set CacheDirLevels to 1. Set CacheDirLength to a value that results in a good balance between the number of directories and the number of files per directory. The value of 2 set below will generate 4096 directories. See the Apache Disk-based Caching documentation for more information.
CacheDirLevels 1 CacheDirLength 2