一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

云服務器|WEB服務器|FTP服務器|郵件服務器|虛擬主機|服務器安全|DNS服務器|服務器知識|Nginx|IIS|Tomcat|

服務器之家 - 服務器技術 - Nginx - Nginx限制搜索引擎爬蟲頻率、禁止屏蔽網絡爬蟲配置示例

Nginx限制搜索引擎爬蟲頻率、禁止屏蔽網絡爬蟲配置示例

2019-10-22 15:31Nginx教程網 Nginx

這篇文章主要介紹了Nginx限制搜索引擎爬蟲頻率、禁止屏蔽網絡爬蟲配置示例,限制爬蟲頻率用于一些無良爬蟲,禁止爬蟲用于一些不需要收錄的網站,需要的朋友可以參考下

代碼如下:


#全局配置
limit_req_zone $anti_spider zone=anti_spider:10m rate=15r/m;

 

#某個server中
 limit_req zone=anti_spider burst=30 nodelay;
 if ($http_user_agent ~* "xxspider|xxbot") {
 set $anti_spider $http_user_agent;
}

 

超過設置的限定頻率,就會給spider一個503。
上述配置詳細解釋請自行google下,具體的spider/bot名稱請自定義。

附:nginx中禁止屏蔽網絡爬蟲

復制代碼代碼如下:


server {  
        listen       80;  
        server_name  www.xxx.com;  
  
        #charset koi8-r;  
  
        #access_log  logs/host.access.log  main;  
  
        #location / {  
        #    root   html;  
        #    index  index.html index.htm;  
        #}  
    if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot") {  
                return 403;  
        }  
  
    location ~ ^/(.*)$ {  
                proxy_pass http://localhost:8080;  
        proxy_redirect          off;  
        proxy_set_header        Host $host;  
        proxy_set_header        X-Real-IP $remote_addr;  
        proxy_set_header       X-Forwarded-For   $proxy_add_x_forwarded_for;  
        client_max_body_size    10m;  
        client_body_buffer_size 128k;  
        proxy_connect_timeout   90;  
        proxy_send_timeout      90;  
        proxy_read_timeout      90;  
        proxy_buffer_size       4k;  
        proxy_buffers           4 32k;  
        proxy_busy_buffers_size 64k;  
        proxy_temp_file_write_size 64k;  
    }  
      
        #error_page  404              /404.html;  
  
        # redirect server error pages to the static page /50x.html  
        #  
        error_page   500 502 503 504  /50x.html;  
        location = /50x.html {  
            root   html;  
        }  
  
        # proxy the PHP scripts to Apache listening on 127.0.0.1:80  
        #  
        #location ~ \.php$ {  
        #    proxy_pass   http://127.0.0.1;  
        #}  
  
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000  
        #  
        #location ~ \.php$ {  
        #    root           html;  
        #    fastcgi_pass   127.0.0.1:9000;  
        #    fastcgi_index  index.php;  
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;  
        #    include        fastcgi_params;  
        #}  
  
        # deny access to .htaccess files, if Apache's document root  
        # concurs with nginx's one  
        #  
        #location ~ /\.ht {  
        #    deny  all;  
        #}  
    }  

 


可以用 curl 測試一下

復制代碼代碼如下:

curl -I -A "qihoobot" www.xxx.com

 

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 1769国产精品免费视频 | 免费日批软件 | 免费一级欧美片片线观看 | 国产精品九九免费视频 | 荷兰精品女人性hd | 大团圆6全文在线阅读 | 日韩一区二三区无 | 亚洲国产欧美在线人成aaaa20 | 国产香蕉视频在线观看 | 国产福利视频一区二区微拍 | 好爽好深好猛好舒服视频上 | 日本三级成人中文字幕乱码 | 国产女主播福利在线 | 亚洲视频日韩 | 免费一级欧美片在线观看 | 妹妹你插的我好爽 | 国产无限制自拍 | 亚洲人成绝费网站色ww | 国产剧情一区二区三区 | 精品久久久久久亚洲精品 | 天堂伊人 | 性关系视频免费网站在线观看 | 男人的天堂comwww | 人人揉揉香蕉 | 亚洲国产精品嫩草影院永久 | 色老板在线免费观看 | 91大神在线精品播放 | 亚洲欧洲淘宝天堂日本 | 国产福利在线免费观看 | 高清在线一区二区 | 亚洲国产精品日韩高清秒播 | 欧美日韩成人在线视频 | 国产成人高清视频 | 国产成人咱精品视频免费网站 | 窝窝午夜理伦影院 | 无限资源在线观看完整版免费下载 | 国产精品免费久久久久影院 | 久久99精品国产免费观看 | 91精品大神国产在线播放 | 91麻豆精品国产片在线观看 | 国产日韩精品一区二区在线观看 |