5、在网站根目录里建立robots.txt,添加如下内容
User-agent: YisouSpiderDisallow: / 6、禁止某个目录执行脚本【单nginx下有效,如使用了nginx+apache组合,php交给apache处理,需要通过.htaccess进行限制】,添加到location ~ .php 之前 location ~* ^/(uploads|templets|data)/.*.(php|php5)$ { return 444; }7、屏蔽某个IP或IP段 #屏蔽192.168.5.23这个IP deny 192.168.5.23; #屏蔽192.168.5.* 这个段 deny 192.168.5.0/24;8、此种方法比较暴力,就是以彼之道,还施彼身,利用伪静态规则进行跳转下载,比如:扫描根目录下的 /web.rar,那么就会触发规则跳转到大文件下载地址。打开网站 Nginx 配置文件,将规则加入 server 内,示例:server { ... # 专治扫描户 rewrite .rar/?$ http://speedtest.tele2.net/100GB.zip permanent; rewrite .tar/?$ http://speedtest.tele2.net/100GB.zip permanent; rewrite .zip/?$ http://speedtest.tele2.net/100GB.zip permanent; rewrite .sql/?$ http://speedtest.tele2.net/100GB.zip permanent; rewrite .gz/?$ http://speedtest.tele2.net/100GB.zip permanent; rewrite .7z/?$ http://speedtest.tele2.net/100GB.zip permanent; # 或者使用 rewrite .(rar|zip|tar|sql|gz|7z)/?$ http://speedtest.tele2.net/100GB.zip permanent; ...}如果觉得 100GB 响应时间有点长,那么可以替换小文件下载地址:10G:新加坡: http://lg-sin.fdcservers.net/10GBtest.zip日本: http://lg-tok.fdcservers.net/10GBtest.zip香港: http://lg-hkg.fdcservers.net/10GBtest.zip1G:日本:http://hnd-jp-ping.vultr.com/vultr.com.1000MB.bin新加坡:https://sgp-ping.vultr.com/vultr.com.1000MB.bin如何测试效果?Linux的vps,比如Centos7 使用Xshell软件连接上VPS。(如何使用Xshell通过SSH连接管理VPS)使用使用下面的命令测试一下就行:模拟UA为空的抓取:curl -I -A '' https://www.78moban.com模拟垃圾爬虫AhrefsBot抓取:curl -I -A 'AhrefsBot' https://www.78moban.com模拟AhrefsBot访问返回:HTTP/1.1 403 Forbidden 则设置生效访问被拦截!模拟百度蜘蛛的抓取:curl -I -A 'Baiduspider' https://www.78moban.com模拟百度蜘蛛访问则成功返回:HTTP/1.1 200 OK表示百度的爬虫是正常可以访问你的网站。附一部分垃圾垃圾爬虫和扫描FeedDemon 内容采集BOT/0.1 sql注入CrawlDaddy sql注入Java 内容采集Jullo 内容采集Feedly 内容采集UniversalFeedParser 内容采集ApacheBench cc攻击器Swiftbot 无用爬虫YandexBot 无用爬虫AhrefsBot 无用爬虫YisouSpider 无用爬虫jikeSpider 无用爬虫MJ12bot 无用爬虫ZmEu phpmyadmin 漏洞扫描WinHttp 采集cc攻击EasouSpider 无用爬虫HttpClient tcp攻击Microsoft URL Control 扫描YYSpider 无用爬虫jaunty wordpress爆破扫描器oBot 无用爬虫Python-urllib 内容采集Indy Library 扫描FlightDeckReports Bot 无用爬虫Linguee Bot 无用爬虫copy © 2025 星澜网络 All Rights Reserved
备案号:鲁ICP备2023015769号