简体   繁体   English

如何获取Apache mod_cache进行缓存?

[英]How do I get Apache mod_cache to cache?

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. 我已经使Apache mod_cache可以在运行Apache 2.2的Windows服务器上按预期工作,但是我无法使其在具有root访问权限的Linux cpanel服务器上运行。

Here's what I know: 这是我所知道的:

1) mod_cache and mod_disk_cache are both compiled into Apache (confirmed with "httpd -l") 1)mod_cache和mod_disk_cache都编译到Apache中(用“ httpd -l”确认)

2) My httpd.conf is configured like this CacheRoot /home/accountname/apache-cacheroot CacheEnable disk / 2)我的httpd.conf像这样配置CacheRoot / home / accountname / apache-cacheroot CacheEnable disk /

3) I've restarted Apache after all configuration changes 3)所有配置更改后,我都重新启动了Apache

4) I know that section of the httpd.conf is being processed (I put some unrelated commands in there to debug.) 4)我知道正在处理httpd.conf的部分(我在其中放置了一些不相关的命令来进行调试。)

5) The file I request displays the current time via php, and it does not change on subsequent requests. 5)我请求的文件通过php显示当前时间,并且在后续请求中不会更改。

...it does not change on subsequent requests ...在以后的请求中不会改变

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. 如果确实在每个请求上都发生了变化,则该请求将由PHP而不是Apache的缓存来处理。

Did you try enabling the modules with a2en cache and a2en disk_cache ? 您是否尝试过使用a2en cachea2en disk_cache启用模块?

Do not forget to restart the server after doing this. 完成此操作后,请不要忘记重新启动服务器。

根据您将CacheRoot设置为什么,您可能需要更改权限以将权限设置为777。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM