訪問控制FilesMatch-apache

訪問控制FilesMatch

filesMatch針對連接進行控制。php

[root@chy ~]# vim /usr/local/apache2.4/conf/extra/httpd-vhosts.conf 
<Directory /data/wwwroot/111.com>
      <FilesMatch admin.php(.*)>
      Order deny,allow
        Deny from all
        Allow from 127.0.0.1
      </FilesMatch>
    </Directory>
(增長的配置有<FilesMatch admin.php(.*)> </FilesMatch> 必須是成對出現 )
測試結果:[root@chy 111.com]# curl -x127.0.0.1:80 'http://www.111.com/admin.php?/dddjjjlllsahog' -I
HTTP/1.1 404 Not Found
Date: Thu, 03 Aug 2017 16:48:12 GMT
Server: Apache/2.4.27 (Unix) PHP/5.6.30
Content-Type: text/html; charset=iso-8859-1
[root@chy 111.com]# curl -x192.168.212.10:80 'http://www.111.com/admin.php?/dddjjjlllsahog' -I
HTTP/1.1 403 Forbidden
Date: Thu, 03 Aug 2017 16:48:35 GMT
Server: Apache/2.4.27 (Unix) PHP/5.6.30
Content-Type: text/html; charset=iso-8859-1
(這裏訪問的域名必須是servername 後面跟的域名)
相關文章
相關標籤/搜索