Linux下屏蔽的多种方法:iptables、nginx、apache、php、.htaccess

2016-04-17 12:18:00
admin
原创
2860
摘要:iptables、nginx、apache、php、.htaccess、屏蔽ip

iptables

封停一个IP
iptables -I INPUT -s 192.168.0.1 -j DROP
解封一个IP
iptables -D INPUT -s 192.168.0.1 -j DROP

nginx

deny 192.168.0.1; 

apache

<Directory  "你的网站根目录">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order  deny,allow
    Deny from 192.168.0.1  
</Directory>
php
<?php
$ip = $_SERVER['REMOTE_ADDR'];
if ($ip == "192.168.0.1") {
    die("ip被屏蔽了");
}
.htaccess
Order Allow,Deny
Allow from all
Deny from 192.168.0.1
发表评论
评论通过审核后显示。
 
在线咨询
售前咨询
售后支持
电话咨询