日期:2014-05-16  浏览次数:20728 次

在Apache权限访问设置

修改VirtualHost文件

?

1. 禁止特定IP

?

<Directory "/var/www/web/">
Order allow,deny
Allow from all
Deny from 10.0.0.1 #阻止一个IP
Deny from 192.168.0.0/24 #阻止一个IP段
</Directory>

?

2. 只允许特定访问

?

<Directory "/var/www/web/">
Order deny,allow
Deny from all
All from example.com #允许某个域名
All from 10.0.0.1 #允许一个iP
All from 10.0.0.1 10.0.0.2 #允许多个iP
Allow from 10.1.0.0/255.255.0.0 #允许一个IP段,掩码对
All from 10.0.1 192.168 #允许一个IP段,后面不填写
All from 192.168.0.0/24 #允许一个IP段,网络号
</Directory>