【发布时间】:2016-08-23 10:19:14
【问题描述】:
我使用以下配置完成了 apache 2.4 的设置
ProxyPass / "http://localhost:9081/"
ProxyPassReverse / "http://localhost:9081/"
<IfModule mod_cache.c>
<IfModule mod_disk_cache.c>
CacheRoot "/opt/apicache/"
CacheDefaultExpire 3600
CacheEnable disk "/"
CacheDirLevels 2
CacheDirLength 1
CacheMaxFileSize 1000000
CacheMinFileSize 1
CacheIgnoreCacheControl On
CacheIgnoreNoLastMod On
CacheIgnoreQueryString Off
CacheIgnoreHeaders None
CacheLastModifiedFactor 0.1
CacheDefaultExpire 3600
CacheMaxExpire 86400
CacheStoreNoStore On
CacheStorePrivate On
# Enable the X-Cache-Detail header
CacheDetailHeader on
</IfModule>
</IfModule>
我也通过以下更改了 CacheRoot 权限
mkdir -p /opt/apicache/
chown root:www-data /opt/apicache/ -R
chmod 775 /opt/apicache/ -R
apache日志级别设置为debug
LogLevel debug
非常不确定为什么 apache 2.4 没有将任何内容缓存到缓存根目录,也没有在错误日志中显示任何日志
【问题讨论】:
-
可能没有加载这些模块。你为什么要打扰 IfModule?
-
我可以看到缓存模块是用下面的命令加载的。忽略完全限定名错误
root@INMHPUUBUNTU14:# ./apachectl -M AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using INMHPUUBUNTU14.04LAP08. Set the ' ServerName' directive globally to suppress this message Loaded Modules: core_module (static) . **cache_module (shared)** **cache_disk_module (shared)** .. alias_module (shared) rewrite_module (shared)
标签: caching disk apache2.4 mod