如何在与安装 OS/Apache 不同的驱动器上设置 Apache mod_disk_cache?
我已经在 apache2.conf 上进行了如下设置:
<IfModule mod_cache_disk.c>
# cache cleaning is done by htcacheclean, which can be configured in
# /etc/default/apache2
#
# For further information, see the comments in that file,
# /usr/share/doc/apache2/README.Debian, and the htcacheclean(8)
# man page.
# This path must be the same as the one in /etc/default/apache2
CacheRoot /media/cacheHD
# This will also cache local documents. It usually makes more sense to
# put this into the configuration for just one virtual host.
CacheEnable disk /
# The result of CacheDirLevels * CacheDirLength must not be higher than
# 20. Moreover, pay attention on file system limits. Some file systems
# do not support more than a certain number of inodes and
# subdirectories (e.g. 32000 for ext3)
CacheDirLevels 2
CacheDirLength 1
</IfModule>
而且它似乎根本没有缓存任何东西。驱动器本身是一个新安装的 ssd 驱动器,使用 ext4 格式化。
答案1
模块mod_cache
必须在加载之前加载disk storage manager module
和往常一样,您必须先加载模块,然后才能尝试配置它们。
您可以使用以下命令确认所有正确的模块是否都已加载:
apachectl -t -D DUMP_MODULES
也许您复制了不完整的配置,但以下内容更完整:
LoadModule cache_module modules/mod_cache.so
<IfModule mod_cache.c>
# If you want to use mod_disk_cache :
LoadModule disk_cache_module modules/mod_disk_cache.so
<IfModule mod_cache_disk.c>
# settings for mod_disk_cache
CacheRoot /media/cacheHD
CacheEnable disk /
CacheDirLevels 2
CacheDirLength 1
</IfModule>
</IfModule>