Apache ExpiresDefault A0不起作用

布罗迪

我正在设置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.

我该如何解决这个错误?

巴里·波拉德

您需要启用mod_expiries。

从httpd.conf取消注释以下行:

LoadModule expires_module modules/mod_expires.so

或者,如果在基于Debian的系统上,则使用以下命令启用它:

a2enmod expires

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章