訪問(wèn)控制的設(shè)置:
創(chuàng)新互聯(lián)建站于2013年開(kāi)始,是專(zhuān)業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目做網(wǎng)站、網(wǎng)站設(shè)計(jì)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元汪清做網(wǎng)站,已為上家服務(wù),為汪清各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:13518219792
假設(shè):在日志里發(fā)現(xiàn)某個(gè)IP 嘗試***我的站點(diǎn),就可以通過(guò)配置把這個(gè)IP 封掉。
拷貝模版
vim /usr/local/apache2/conf/httpd.conf
AllowOverride None
Options None
Order allow,deny #Order :誰(shuí)在前,先執(zhí)行誰(shuí)。不分上下,只分前后。
Allow from all #允許所有IP
Deny from 127.0.0.1 # 控制這個(gè)IP
[root@OBird ~]# apachectl -t
Syntax OK
[root@OBird ~]# apachectl restart
[root@OBird ~]# curl -x127.0.0.1:80 -I www.test.com
HTTP/1.1 403 Forbidden #此時(shí)訪問(wèn)不到127.0.0.1
Date: Tue, 27 Sep 2016 12:31:27 GMT
Server: Apache/2.2.31 (Unix) PHP/5.6.24
Content-Type: text/html; charset=iso-8859-1
-------------------------------------------------------------------------------------------
白名單限制,限制指定的IP 訪問(wèn)。
[root@OBird ~]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
[root@OBird ~]# apachectl -t
Syntax OK
[root@OBird ~]# apachectl restart
[root@OBird ~]# curl -x10.72.4.30:80 -I www.test.com/admin.php
HTTP/1.1 403 Forbidden #限制成功,403 不能訪問(wèn)
Date: Tue, 27 Sep 2016 12:46:15 GMT
Server: Apache/2.2.31 (Unix) PHP/5.6.24
Content-Type: text/html; charset=iso-8859-1
---------------------------------------------
[root@OBird ~]# curl -x127.0.0.1:80 -I www.test.com/admin.php
HTTP/1.1 200 OK # 可以訪問(wèn)
Date: Tue, 27 Sep 2016 12:48:48 GMT
Server: Apache/2.2.31 (Unix) PHP/5.6.24
X-Powered-By: PHP/5.6.24
Set-Cookie: gfwC_2132_saltkey=IYZYTY7u; expires=Thu, 27-Oct-2016 12:48:48 GMT; Max-Age=2592000; path=/; httponly
Set-Cookie: gfwC_2132_lastvisit=1474976928; expires=Thu, 27-Oct-2016 12:48:48 GMT; Max-Age=2592000; path=/
Set-Cookie: gfwC_2132_sid=POGGLH; expires=Wed, 28-Sep-2016 12:48:48 GMT; Max-Age=86400; path=/
Set-Cookie: gfwC_2132_lastact=1474980528%09admin.php%09; expires=Wed, 28-Sep-2016 12:48:48 GMT; Max-Age=86400; path=/
Cache-Control: max-age=0
Expires: Tue, 27 Sep 2016 12:48:48 GMT
Content-Type: text/html; charset=gbk