我已经输入了httpd.conf
# 480 weeks
<filesmatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=290304000, public"
</filesmatch>
# 2 days
<filesmatch "\.(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</filesmatch>
# 2 hours
<filesmatch "\.(html|htm)$">
Header set Cache-Control "max-age=7200, must-revalidate"
</filesmatch>
Run Code Online (Sandbox Code Playgroud)
但是当我运行时/etc/init.d/apache restart
(在 Debian 6.0 中)我得到:
Syntax error on line 3 of /etc/apache2/httpd.conf:
Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
failed!
Run Code Online (Sandbox Code Playgroud)
要使用Header
指令,您需要加载mod_headers:
sudo a2enmod headers
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2380 次 |
最近记录: |