<Directory /data/wwwroot/111.com/admin/>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Directory>
[root@hf-01 ~]# vim /usr/local/apache2.4/conf/extra/httpd-vhosts.conf
将代码放在防盗链代码上面,防止冲突
<Directory /data/wwwroot/111.com/admin/>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Directory>
[root@hf-01 ~]# cd /data/wwwroot/111.com
[root@hf-01 111.com]# ls
11.png 123.php
[root@hf-01 111.com]# mkdir admin/
[root@hf-01 111.com]# cd admin/
[root@hf-01 admin]# ls
[root@hf-01 admin]# touch index.php
[root@hf-01 admin]# echo "121212" > index.php
[root@hf-01 admin]# ls
index.php
[root@hf-01 admin]# cat index.php
121212
[root@hf-01 admin]# cd ..
[root@hf-01 111.com]#
[root@hf-01 111.com]# /usr/local/apache2.4/bin/apachectl -t
Syntax OK
[root@hf-01 111.com]# /usr/local/apache2.4/bin/apachectl graceful
[root@hf-01 111.com]#
[root@hf-01 111.com]# curl -x127.0.0.1:80 111.com/admin/index.php -I
HTTP/1.1 200 OK
Date: Mon, 25 Dec 2017 23:42:01 GMT
Server: Apache/2.4.29 (Unix) PHP/5.6.30
X-Powered-By: PHP/5.6.30
Content-Type: text/html; charset=UTF-8
[root@hf-01 111.com]#
[root@hf-01 111.com]# curl -x192.168.74.150:80 111.com/admin/index.php -I
HTTP/1.1 403 Forbidden
Date: Mon, 25 Dec 2017 23:47:06 GMT
Server: Apache/2.4.29 (Unix) PHP/5.6.30
Content-Type: text/html; charset=iso-8859-1
[root@hf-01 111.com]#