Apache: edit the .conf file, you will get "Invalid command" Header '"

In Magento CE, I would like to install an extension to the Extendware Cache cache called Lightening Cache.

It is required to edit the Apache configuration in the virtual host definition for the site, adding:

RewriteEngine On RewriteMap ewpchash prg:/home/.../shell/extendware/ewpagecache/apache/md5.php RewriteCond %{REQUEST_METHOD} !POST RewriteCond %{REQUEST_URI} !\.(js|css|png|jpg|jpeg|ico|gif)$ [NC] RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} !-f RewriteCond ${ewpchash:%{HTTPS};~;%{HTTP_HOST};~;%{REQUEST_URI};~;%{QUERY_STRING};~;%{HTTP:Cookie};~;%{SCRIPT_FILENAME};~;%{REMOTE_ADDR};~;%{HTTP_USER_AGENT}} -f RewriteRule ^(.*)$ ${ewpchash:%{HTTPS};~;%{HTTP_HOST};~;%{REQUEST_URI};~;%{QUERY_STRING};~;%{HTTP:Cookie};~;%{SCRIPT_FILENAME};~;%{REMOTE_ADDR};~;%{HTTP_USER_AGENT}} [NC,L] <FilesMatch "\.(html)$"> Header unset Cache-Control Header unset Expires Header append Expires "Thu, 19 Nov 1981 08:52:00 GMT" Header append Cache-Control "must-revalidate" </FilesMatch> 

I added this to the bottom of / etc / apache 2 / sites-enabled / site.conf

When I run the apachectl graceful command, I get an error message:

AH00526: Syntax error on line 53 / etc / apache 2 / sites-enabled / site.conf: Invalid 'Header' command, possibly incorrectly written or determined by a module not included in the server Configuration Action "graceful" failed. The Apache error log may have additional information.

Site works with Apache 2.4

Did I do something wrong?

+7
apache rewrite magento
source share
1 answer

To use the header directive in apache, you need to load the mod_header module. You can check if the module is loaded or not: -

apache2ctl -M | grep headers_module

find / -name mod_headers.so

If it is loaded, you will see something like: -

headers_module (shared)

/usr/lib/apache2/modules/mod_headers.so

If you do not see the output of the find command, rather than loading this module directly into the apache conf file. Just add the line below: -

LoadModule headers_module modules/mod_headers.so

Note. - mod_header is available as a base module in apache. Therefore you do not need to explicitly install it.

Run the following command: -

a2enmod headers

Restart web service

apache2ctl restart

+10
source share

All Articles