我尝试在 centos 6 / apache 2.2 上启动 httpd 但出现以下错误:
/etc/init.d/httpd start
Starting httpd: [Sun Nov 08 20:47:36 2015] [warn] module php5_module is already loaded, skipping
Syntax error on line 5 of /etc/httpd/conf/extra/httpd-directories.conf:
Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration
[FAILED]
经过搜索我找到了一些解决方案,例如改变
Order deny,allow
Deny from all
到
Require all denied
但这是针对 apache 2.4 的,而我正在运行 2.2
我有点卡在这里,所有网站都瘫痪了。有人能帮我吗?
编辑:
这是我的 httpd-directories.conf 文件:
<Directory />
Options SymLinksIfOwnerMatch
AllowOverride None
Order Deny,Allow
Deny from All
</Directory>
<Directory /home>
AllowOverride AuthConfig FileInfo Indexes Limit Options=Includes,IncludesNOEXEC,Indexes,ExecCGI,MultiViews,SymLinksIfOwnerMatch,None
Options IncludesNoExec Includes SymLinksIfOwnerMatch ExecCGI
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
<Directory /var/www/html>
Options SymLinksIfOwnerMatch
AllowOverride AuthConfig FileInfo Indexes Limit Options=Includes,IncludesNOEXEC,Indexes,ExecCGI,MultiViews,SymLinksIfOwnerMatch,None
Order allow,deny
Allow from all
<IfModule mod_suphp.c>
suPHP_Engine On
suPHP_UserGroup webapps webapps
SetEnv PHP_INI_SCAN_DIR
</IfModule>
</Directory>
<Directory /var/www/cgi-bin>
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
答案1
看起来你缺少 authz_host 模块,请确保你的/etc/httpd/conf/httpd.conf
文件有一行类似
LoadModule authz_host_module modules/mod_authz_host.so
在其中。如果我从 httpd.conf 中注释掉该行,则会得到与您看到的相同的错误。
答案2
一些未经检验的想法:
开始标签中的 / 应该加引号吗?
<Directory "/">
此外,文档中显示 Deny 和 Allow 指令均采用小写形式。
Order deny,allow
例子:
<Directory "/">
Options SymLinksIfOwnerMatch
AllowOverride None
Order deny,allow
Deny from All
</Directory>