当前位置:web 服务器 > Nginx >>

nginxweb服务器 禁止垃圾搜索引擎爬虫访问网站的方法

直接修改网站配置文件,Root.txt只是防君子,意义不大:

server {   

    listen 80;
    server_name zzzyk.com www.zzzyk.com;
     index index.html index.htm index.php default.html default.htm default.php;
     root  /home/zzzyk.com


#禁止垃圾蜘蛛抓取


if ($http_user_agent ~* (SemrushBot|GPTBot|python|Linespider|crawler|DingTalkBot|simplecrawler|ZoominfoBot|zoombot|Neevabot|coccocbot|Facebot|YandexBot|Adsbot|DotBot|Applebot|DataForSeoBot|MJ12bot|BLEXBot|trendictionbot0|trendictionbot|AhrefsBot|hubspot|opensiteexplorer|leiki|webmeup)) { 

return 403;

}


# 其他参数配置

    access_log /home/log/zzzyk.com.log

}


代码里面的这些蜘蛛基本上都是无用蜘蛛,就像我的蜘蛛里的占最头的SemrushBot就是营销蜘蛛,还有一些是对网站没啥用的蜘蛛如Facebot、Applebot等。

您也可以根据网站日志自行配置

Apache
IIS
Nginx
Tomcat
如果你遇到web 服务器难题:
访问www.zzzyk.com 试试
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,