Apache启动 报Invalid command 'order', perhaps misspelled or defined by a module not included
2017-08-21 23:02
459 查看
Apache2.4较Apache2.2做了些改进。
Upgrading to 2.4 from 2.2 http://httpd.apache.org/docs/2.4/upgrading.html
mod_authz_host.so模块没有加载,但检查后发现httpd.conf中: 该模块并未被注释掉,那原因究竟出在哪里?
说来也巧,既然网上有提到这种错误的出现是因为某模块未被加载,于是笔者索性随手取消掉了第一行的模块注释,通过Apache Service Moniter重启服务……
!!竟然没再报错,那问题就出在这个模块上了:
搜索 mod_access_compat.so这个模块,发现如下文章:
原来在Apache2.4版本中,提供了由mod_authz_host支持的新的访问控制配置语法。而2.2版本中的Order、Allow等命令在新版本中也可以得到兼容,实现这个兼容功能的模块就是mod_access_compat。所以Load这个模块后,apache2.4就能识别这些语句了。
Apache2.4和Apache2.2访问控制配置比较
一、访问控制
在Apache2.2版本中,访问控制是基于客户端的主机名、IP地址以及客户端请求中的其他特征,使用Order(排序), Allow(允许), Deny(拒绝),Satisfy(满足)指令来实现。
在Apache2.4版本中,使用mod_authz_host这个新的模块,来实现访问控制,其他授权检查也以同样的方式来完成。旧的访问控制语句应当被新的授权认证机制所取代,即便Apache已经提供了mod_access_compat这一新模块来兼容旧语句。
这里有一些实例,用新方法取代旧语句实现相同的访问控制
实例1:所有请求都被拒绝
Apache2.2 配置:
代码如下:
Order deny,allow #排序,先拒绝后允许
Deny from all #拒绝所有
Apache2.4 配置:
代码如下:
Require all denied #拒绝所有
实例2:所有请求都被允许
Apache2.2 配置:
代码如下:
Order allow,deny #排序,先允许后拒绝
Allow from all #允许所有
Apache2.4 配置:
代码如下:
Require all granted #允许所有
实例3:example.org所有请求都被允许,其他拒绝
Apache2.2 配置:
代码如下:
Order Deny,Allow #排序,先拒绝后允许
Deny from all #拒绝所有
Allow from example.org #允许example.org
Apache2.4 配置:
代码如下:
Require host example.org #拒绝所有
二、Apache Require 指令
了解更多require指令用法:《Apache Module mod_authz_core》
附:常见访问控制指令
代码如下:
Require all granted #允许所有
Require all denied #拒绝所有
Require env env-var [env-var] ... #允许,匹配环境变量中任意一个
Require method http-method [http-method] ... #允许,特定的HTTP方法
Require expr expression #允许,表达式为true
Require user userid [ userid ] ... #允许,特定用户
Require group group-name [group-name] ... #允许,特定用户组
Require valid-user # #允许,有效用户
Require ip 10 172.20 192.168.2 #允许 特定IP
相关文章推荐
- elgg 安装启动apache2.4后报Invalid command 'order', perhaps misspelled or defined by a module not included
- Apache启动报错:Invalid command 'ProxyPass', perhaps misspelled or defined by a module not inclu ded in t
- .htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the
- Apache Error: Invalid command ‘Allow’, perhaps misspelled or defined by a module not included in the server configuration
- [Ubuntu] Invalid command 'VirtualDocumentRoot', perhaps misspelled or defined by a module not included in the server configuration
- Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a module not included in the ser
- Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a module not included in the ser
- .htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
- Invalid command 'SSLCipherSuite', perhaps misspelled or defined by a module not included in the serv
- nvalid command 'PythonPath', perhaps misspelled or defined by a module not included in the server co
- Apache启动错误:Invalid command 'Order'
- php 修改了网页访问存储目录,Apache2.4启动时报AH00526错误(Invalid command 'Order')
- Module 'starter' is not available! You either misspelled the module name or forgot to load it.
- Invalid command 'PHPIniDir', perhaps misspelled 的解决
- 启动 apache2.4 出现 invalid command order 问题 【由于 PHP 访问权限 403 问题引起】
- 阿里云 esc 云服务器无缘无故的一次/usr/bin 目录丢失导致整个服务无法启动 # ./shutdown.sh ./shutdown.sh: line 41: dirname:command not found cannot find /catalina.sh the find /catalina.sh The file is absent or does not have execute
- invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
- Apache2.4启动时报AH00526错误(Invalid command 'Order')
- mac 下从设置启动mysql 失败,“Warning:The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mys
- flume启动Could not find or load main class org.apache.flume.node.Application