zoukankan      html  css  js  c++  java
  • Nginx 常用屏蔽规则

    //在 /www/server/nginx/conf 新建文件 bot.conf
    #禁止垃圾搜索引擎蜘蛛抓取
    
    if ($http_user_agent ~* "CheckMarkNetwork|Synapse|Nimbostratus-Bot|Dark|scraper|LMAO|Hakai|Gemini|Wappalyzer|masscan|crawler4j|Mappy|Center|eright|aiohttp|MauiBot|Crawler|researchscan|Dispatch|AlphaBot|Census|ips-agent|NetcraftSurveyAgent|ToutiaoSpider|EasyHttp|Iframely|sysscan|fasthttp|muhstik|DeuSu|mstshash|HTTP_Request|ExtLinksBot|package|SafeDNSBot|CPython|SiteExplorer|SSH|MegaIndex|BUbiNG|CCBot|NetTrack|Digincore|aiHitBot|SurdotlyBot|null|SemrushBot|Test|Copied|ltx71|Nmap|DotBot|AdsBot|InetURL|Pcore-HTTP|PocketParser|Wotbox|newspaper|DnyzBot|redback|PiplBot|SMTBot|WinHTTP|Auto Spider 1.0|GrabNet|TurnitinBot|Go-Ahead-Got-It|Download Demon|Go!Zilla|GetWeb!|GetRight|libwww-perl|Cliqzbot|MailChimp|SMTBot|Dataprovider|XoviBot|linkdexbot|SeznamBot|Qwantify|spbot|evc-batch|zgrab|Go-http-client|FeedDemon|JikeSpider|Indy Library|Alexa Toolbar|AskTbFXTV|AhrefsBot|CrawlDaddy|CoolpadWebkit|Java|UniversalFeedParser|ApacheBench|Microsoft URL Control|Swiftbot|ZmEu|jaunty|Python-urllib|lightDeckReports Bot|YYSpider|DigExt|YisouSpider|HttpClient|MJ12bot|EasouSpider|LinkpadBot|Ezooms") {
     return 444;
     break;
    }
    
    #禁止扫描工具客户端
    
    if ($http_user_agent ~* (Curl|SemrushBot|python|MJ12bot|AhrefsBot|AhrefsBot|hubspot|opensiteexplorer|leiki|webmeup)) {
         return 444;
         break;
    }

    nginx的444状态是直接由服务器中断连接,不会向客户端再返回任何消息,比返回403更加暴力。

    网站中找到对应的网站, 设置->配置文件 加入下面这行代码 保存

    include bot.conf; 
  • 相关阅读:
    一次向svn中增加所有新增文件 svn add all new files
    cocos2d-x Lua与OC互相调用
    IOS8开发之实现App消息推送
    IOS Remote Notification
    再见
    vue中$router.push打开新窗口
    nuxt拦截IE浏览器
    百度统计api获取数据
    css滚动条样式自定义
    nuxt框架Universal和Spa两种render mode的区别
  • 原文地址:https://www.cnblogs.com/LF-place/p/13920803.html
Copyright © 2011-2022 走看看