如何让 Apache mod_cache 进行缓存?
我已经让 Apache mod_cache 在运行 Apache 2.2 的 Windows 服务器上按预期工作,但在我拥有 root 访问权限的 Linux cpanel 服务器上运行它时遇到了问题。
这是我所知道的:
1)mod_cache和mod_disk_cache都编译到Apache中(用“httpd -l”确认)
2)我的httpd.conf配置如下 CacheRoot /home/帐户名/apache-cacheroot 缓存启用磁盘 /
3) 在所有配置更改后,我重新启动了 Apache
4) 我知道 httpd.conf 的该部分正在处理(我在其中放置了一些不相关的命令进行调试。)
5) 我请求的文件通过 php 显示当前时间,并且它不会因后续请求而改变。
I've gotten Apache mod_cache to work as intended on a Windows server running Apache 2.2, but I'm having trouble getting it running on a Linux cpanel server to which I have root access.
Here's what I know:
1) mod_cache and mod_disk_cache are both compiled into Apache (confirmed with "httpd -l")
2) My httpd.conf is configured like this
CacheRoot /home/accountname/apache-cacheroot
CacheEnable disk /
3) I've restarted Apache after all configuration changes
4) I know that section of the httpd.conf is being processed (I put some unrelated commands in there to debug.)
5) The file I request displays the current time via php, and it does not change on subsequent requests.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来您的缓存正在工作。如果每个请求都发生变化,则该请求将由 PHP 而不是 Apache 的缓存提供服务。
It sounds like your caching is working. If it did change on every request, then the request is being served by PHP instead of Apache's cache.
您是否尝试使用
a2en cache
和a2en disk_cache
启用模块?执行此操作后,不要忘记重新启动服务器。
Did you try enabling the modules with
a2en cache
anda2en disk_cache
?Do not forget to restart the server after doing this.
根据您的 CacheRoot 设置,您可能需要更改权限以将权限设置为 777。
Depending on what your have your CacheRoot set to, you may need to change the permissions to make the permissions 777.