1.编辑虚拟主机文件
vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Deny from 127.0.0.1
</Directory>
------允许所有的ip访问,禁止127.0.0.1的访问 (不能先禁止,再允许所有)
<filesmatch "(.*)admin(.*)">
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from 2.2.2.2
</filesmatch>
----访问带有admin的网址的网页,只允许127.0.0.1和2.2.2.2的IP访问
原文地址:http://11706174.blog.51cto.com/11696174/1787427