Linux下屏蔽的多种方法:iptables、nginx、apache、php、.htaccess
- 2016-04-17 12:18:00
- admin 原创
- 3166
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
发表评论
