Apache2.4和Apache2.2访问控制配置比较
2016-03-13 17:06
656 查看
多次配置Apache 老是会忘记 找了一下资料保存以后参考
http://httpd.apache.org/docs/2.4/upgrading.html
http://httpd.apache.org/docs/2.4/howto/access.html
官方文档
一、访问控制
在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
http://httpd.apache.org/docs/2.4/upgrading.html
http://httpd.apache.org/docs/2.4/howto/access.html
官方文档
一、访问控制
在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
相关文章推荐
- Apache 服务器配置详解
- 各种VC9 VC11版本的Apache
- 搭建PHP环境需要安装Apache服务器,遇到的一系列的问题(切记需要用管理权限进入CMD)
- Python+Apache+CGI完全配置
- 关闭Apache显示文件列表
- apache文件服务安装,脚本下载
- WAMP的Apache多域名配置
- apache 环境的搭建
- org.apache.jasper.JasperException: Unable to compile class for JSP:
- Apache Shiro 使用手冊 链接文件夹整理
- Apache和PHP的安装
- Apache Commons Configuration读取xml配置
- Apache Commons Configuration读取xml配置
- Apache solr和elastic search的比较
- org.apache.cxf.interceptor.Fault: Could not start Jetty server on port 8,888: Cannot assign requeste
- Python+Apache+CGI完全配置
- Heartbeat V1+NFS实现高可用apache
- 门户应用Apache Jetspeed 2.3.0及早期版本:远程代码执行漏洞分析
- Apache安装
- java.lang.NullPointerException at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmen