Apache中限制某些IP访问某个网页
时间:2008-12-22 来源:r_a
查文档可知,在配置文件httpd.conf中可限制某些IP访问某个WEB目录,但只限定某一文件行不行呢?
做测试如下:
在httpd.conf中加入,
<Directory "/webroot/index2.php">
Order Deny,Allow
allow from 10.0.0.0/255.255.255.0 10.0.107.0/255.255.255.0
deny from all
</Directory> 重启WEB,在浏览器测试:
http://10.0.0.61/index2.php 显示如下:
Order Deny,Allow
allow from 10.0.0.0/255.255.255.0 10.0.107.0/255.255.255.0
deny from all
</Directory> 重启WEB,在浏览器测试:
http://10.0.0.61/index2.php 显示如下:
Forbidden
You don't have permission to access /index2.php on this server.
Apache/2.0.59 (Unix) PHP/4.4.4 mod_jk/1.2.23 Server at 10.0.0.61 Port 80 看来可行。 相关阅读 更多 +