【发布时间】:2017-12-13 15:51:50
【问题描述】:
我正在设置 apache 标头,不想缓存 PHP、CGI、Python 或任何动态文件。
我正在使用服务器:Debian 9
我已经添加了这个配置:
# No caching for dynamic files
<filesMatch "\.(php|cgi|pl|htm)$">
ExpiresDefault A0
Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
Header set Pragma "no-cache"
</filesMatch>
但显示以下错误:
AH00526: Syntax error on line 86 of /etc/apache2/conf-enabled/headers.conf: Invalid command 'ExpiresDefault', perhaps misspelled or defined by a module not included in the server configuration Action '-t' failed.
我该如何解决这个错误?
【问题讨论】:
-
为什么你认为这不起作用?语法对我来说很好,但如果您需要解决方案的帮助,请解释问题。您是否打开了 ExpiresActive 标志 (httpd.apache.org/docs/current/mod/…)?
-
AH00526:/etc/apache2/conf-enabled/headers.conf 第 86 行的语法错误:无效命令“ExpiresDefault”,可能拼写错误或由服务器配置操作中未包含的模块定义-t' 失败。
-
我正在使用这个Apache配置文件github.com/gregrickaby/The-Perfect-Apache-Configuration
标签: apache2.4