无效的命令"Require",可能是拼写错误或由服务器配置中未包含的模块定义的

Zna*_*kus 21 apache configuration wampserver

我刚刚在我的开发机器上安装了最新版本的WAMP,我无法让它工作.得到这个奇怪的错误.

C:\wamp\bin\apache\Apache2.4.4\bin>httpd.exe
AH00526: Syntax error on line 224 of C:/wamp/bin/apache/Apache2.4.4/conf/httpd.conf:
Invalid command 'Require', perhaps misspelled or defined by a module not included in the server configuration

C:\wamp\bin\apache\Apache2.4.4\bin>httpd.exe -v
Server version: Apache/2.4.4 (Win64)
Server built:   Feb 22 2013 22:08:37
Run Code Online (Sandbox Code Playgroud)

这是第224行的配置:

222: <Directory />
223:    AllowOverride none
224:    Require all granted
225: </Directory>
Run Code Online (Sandbox Code Playgroud)

知道我做错了什么吗?

Vor*_*ura 41

Require指令由mod_authz_core提供.如果模块尚未编译到Apache二进制文件中,则需要在配置文件中添加一个条目以手动加载它.您可以检查编译的模块httpd.exe -l.

如果编译模块,请使用类似于以下内容的配置行加载它:

LoadModule authz_core_module    "<apache install dir>/modules/standard/mod_authz_core.so"
Run Code Online (Sandbox Code Playgroud)

当然,您需要调整系统的路径,而在Windows框中,库可能dll不是so文件而是文件.

  • 谢谢@dannio,你解决了我的问题。但是我可以将您的命令编辑为`a2enmod authz_host access_compat`。 (2认同)