——————屏蔽地区IP iptables ——————
http://www.ipdeny.com/ipblocks/
# wget http://www.ipdeny.com/ipblocks/data/countries/cn.zone
#!/bin/bash
# Block traffic from a specific country
# written by vpsee.com
COUNTRY = "cn"
IPTABLES = /sbin/iptables
EGREP = /bin/egrep
if [ "$(id -u)" != "0" ]; then
echo "you must be root" 1>&2
exit 1
fi
resetrules() {
$IPTABLES -F
$IPTABLES -t nat -F
$IPTABLES -t mangle -F
$IPTABLES -X
}
resetrules
for c in $COUNTRY
do
country_file = $c.zone
IPS = $($EGREP -v "^#|^$" $country_file)
for ip in $IPS
do
echo "blocking $ip"
$IPTABLES -A INPUT -s $ip -j DROP
done
done
exit 0
生成一个blocklist列表加到.htaccess文件中去,这个应该是真的屏蔽办法。这个站本身被墙了
——————屏蔽搜索引擎——————
#限制的搜索引擎的User-Agent代码,*表示所有##############
User-agent: *
#限制不能搜索的目录,Disallow: 为空时开放所有目录######
Allow: /admin/blogmove/
Disallow: /admin/
Disallow: /include/
Disallow: /html/
Disallow: /queue/
Disallow: /config/
#开放搜索的目录有####################################
# /
# /advice/
# /help/
# /lm/
# /main/
# /myblog/
#搜索引擎User-Agent代码对照表########################
# 搜索引擎 User-Agent代码
# AltaVista Scooter
# Infoseek Infoseek
# Hotbot Slurp
# AOL Search Slurp
# Excite ArchitextSpider
# Google Googlebot
# Goto Slurp
# Lycos Lycos
# MSN MSNBOT
# Netscape Googlebot
# NorthernLight Gulliver
# WebCrawler ArchitextSpider
# Iwon Slurp
# Fast Fast
# DirectHit Grabber
# Yahoo Web Pages Googlebot
# Looksmart Web Pages Slurp
# Baiduspider Baidu
——————nginx屏蔽——————
ip.conf的文件然后include ip.conf;
Nginx comes with a simple module called ngx_http_access_module to allow or deny access to IP address. The syntax is as follows:
deny IP;
deny subnet;
allow IP;
allow subnet;
# block all ips
deny all;
# allow all ips
allow all;
Note rules are checked in the order of their record to the first match.
How Do I Configure Nginx To Block IPs?
Edit nginx.conf file, enter (note my nginx path is set to /usr/local/nginx/, replace this according to your setup):
# cd /usr/local/nginx/conf/
# vi nginx.conf
Add the following line in http section:
## Block spammers and other unwanted visitors ##
include blockips.conf;
Save and close the file. Finally, create blockips.conf in /usr/local/nginx/conf/, enter:
# vi blockips.conf
Append / add entries as follows:
deny 1.2.3.4;
deny 91.212.45.0/24;
deny 91.212.65.0/24;
Save and close the file. Test the config file, enter:
# /usr/local/nginx/sbin/nginx -t
——————浏览器屏蔽——————
JS大概的代码如下:
复制内容到剪贴板 代码:<script language="javascript">
<!--
var lang = navigator.language || navigator.userLanguage;
if(lang.substr(0, 3) == "zh-")
location = "/404.html";
else
;
//-->
</script>
参考:
屏蔽中国IP
https://bbs.zephyrxt.com/thread-3450-1-1.html
DNS屏蔽国内IP
https://bbs.zephyrxt.com/thread-3452-1-1.html
用 iptables 屏蔽来自某个国家的 IP
https://bbs.zephyrxt.com/thread-3732-1-1.html
屏蔽优酷、土豆等视频网站内的视频广告 & Google Hosts列表
https://bbs.zephyrxt.com/thread-6861-1-1.html
最新版去屏蔽土豆、优酷、奇艺视频广告
https://bbs.zephyrxt.com/thread-4503-1-1.html
屏蔽某个网站来源的用户的脚本
https://bbs.zephyrxt.com/thread-7653-1-1.html
教你robots文件使用方法,屏蔽搜索抓取方法
https://bbs.zephyrxt.com/thread-3260-1-1.html
如何屏蔽搜索引擎的文章!
https://bbs.zephyrxt.com/thread-3259-1-1.html
设置robots.txt文件使其屏蔽搜索引擎收录网站部分页面
https://bbs.zephyrxt.com/thread-3261-1-1.html
教你robots文件使用方法,屏蔽搜索抓取方法
https://bbs.zephyrxt.com/thread-3260-1-1.html
Nginx Block And Deny IP Address OR Network Subnets
https://bbs.zephyrxt.com/thread-9716-1-1.html
Nginx 屏蔽中国IP大全
https://bbs.zephyrxt.com/thread-9717-1-1.html