conf文件的编辑会产生

conf文件的编辑会产生

本文介绍了Apache:对.conf文件的编辑会产生“无效命令'Header'";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Magento CE中,我想为Extendware页面缓存安装一个名为Lightening Cache的加载项.

In Magento CE, I'd like to install an add-on to Extendware Page Cache called Lightening Cache.

它需要通过添加以下内容来在网站的虚拟主机定义中编辑Apache配置:

It requires editing the Apache configuration inside the virtual host definition for the site, by 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>

我已将其添加到/etc/apache2/sites-enabled/site.conf

I have added this to the bottom of /etc/apache2/sites-enabled/site.conf

当我运行命令"apachectl graceful"时,收到错误消息:

When I run the command "apachectl graceful', I receive the error:

站点正在运行Apache 2.4

Site is running Apache 2.4

我做错了什么吗?

推荐答案

为了在Apache中使用Header指令,您必须加载mod_header模块.您可以通过以下方法测试模块是否已加载:-

In order to use Header directive in apache you have to load mod_header module.You can test if module is loaded or not by :-

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

如果您没有找到find命令的输出,则直接在apache conf文件中加载了该模块.只需在行以下附加:-

If you see no output of find command than load that module directly in your apache conf file. Just append below line :-

LoadModule headers_module modules/mod_headers.so

发出以下命令:-

a2enmod headers

重新启动Web服务

apache2ctl restart

这篇关于Apache:对.conf文件的编辑会产生“无效命令'Header'";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 19:37