Linux 无效的命令“Order”,可能是拼写错误或由未包含在服务器配置中的模块定义失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10925528/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 06:41:33  来源:igfitidea点击:

Invalid command ‘Order’, perhaps misspelled or defined by a module not included in the server configuration failed

linuxapache

提问by thuan leminh

when i try to start or restart my apache server , i get bellow message :

当我尝试启动或重新启动我的 apache 服务器时,我收到以下消息:

Syntax error on line 162 of /etc/apache2/apache2.conf:
Invalid command 'Order', 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!

and i try find this error on google and fix it :

我尝试在谷歌上找到这个错误并修复它:

http: //linuxindetails.wordpress.com/2009/12/02/invalid-command-order-perhaps-misspelled-or-defined-by-a-module-not-included-in-the-server-configuration-failed/

http: //linuxindetails.wordpress.com/2009/12/02/invalid-command-order-perhaps-misspelled-or-defined-by-a-module-not-included-in-the-server-configuration-failed/

i get error : Module authz_host does not exist!

我得到错误: Module authz_host does not exist!

so , some body help me to fix it ?

所以,有人帮我修好吗?

thank !

谢谢 !

回答by JHill

You need to enable the authz_hostmodule. Here is the Apache documentation on that module.

您需要启用该authz_host模块。这是有关该模块的 Apache 文档。

I'm not sure what Linux distribution you are using but here are some examples.

我不确定您使用的是什么 Linux 发行版,但这里有一些示例。

Ubuntu:

Ubuntu:

sudo a2enmod authz_host
sudo service apache2 restart

RHEL:

瑞尔:

vi /etc/httpd/conf/httpd.conf

# Make sure this line is not commented:
...
LoadModule authz_host_module modules/mod_authz_host.so
...

回答by Chris Novak

On SUSE 12, authz_host was already enabled, so I needed to follow willoller's comment and enable mod_access_compat:

在 SUSE 12 上,authz_host 已经启用,所以我需要按照willoller的评论并启用 mod_access_compat:

a2enmod mod_access_compat
service apache2 restart

回答by user989383

With Apache 2.4 please uncomment/add the following modules:

对于 Apache 2.4,请取消注释/添加以下模块:

LoadModule access_compat_module modules/mod_access_compat.so
LoadModule authz_host_module modules/mod_authz_host.so

回答by TheFan1968

I just had the same problem while upgrading from openSUSE 13.2 to openSUSE Leap 42.1.

我刚从 openSUSE 13.2 升级到 openSUSE Leap 42.1 时遇到了同样的问题。

The problem is not a missing module in the apache2-configuration.

问题不是 apache2 配置中缺少模块。

The problem is the upgrade from apache 2.2 to apache 2.4. "Order" and "Allow" have to be rewritten as follows (example):

问题是从 apache 2.2 升级到 apache 2.4。“订单”和“允许”必须改写如下(示例):

in 2.2:

在 2.2:

Order allow,deny
Allow from all

in 2.4:

在 2.4:

Require all granted

You can find more options an examples here: Upgrading apache2

您可以在此处找到更多选项和示例: 升级 apache2

回答by Eugen Mihailescu

If you are running Apache2.4 on Gentoothen make sure you enable the following USEflags that will build the mod_authz_hostinto apachebinary:

如果您在Gentoo上运行 Apache2.4,请确保启用以下USE标志以将其构建mod_authz_hostapache二进制文件:

  • apache2_modules_authz_host: Group authorizations based on host (name or IP address)
  • apache2_modules_access_compat: Group authorizations based on host (name or IP address). Available as a compatibility module with previous versions.
  • apache2_modules_authz_host: 基于主机(名称或 IP 地址)的组授权
  • apache2_modules_access_compat: 基于主机(名称或 IP 地址)的组授权。可作为与以前版本兼容模块使用

If you are compiling the Apache2.4 from source code then you can follow the same guidance by using the build-time configuration options (complete list here).

如果您正在从源代码编译 Apache2.4,那么您可以使用构建时配置选项(此处为完整列表)来遵循相同的指南。