Reputation: 57
I am setting up apache headers and do not want to cache PHP, CGI, Python, or any dynamic files.
I am using the server: Debian 9
I have added this config:
# 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>
But following error is shown:
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.
How do I solve this error?
Upvotes: 3
Views: 3462
Reputation: 45980
You need to enable mod_expiries.
Uncomment the following line from httpd.conf:
LoadModule expires_module modules/mod_expires.so
Or if on Debian based system then enable it with the following command:
a2enmod expires
Upvotes: 5