最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Nginx限制搜索引擎爬蟲(chóng)頻率、禁止屏蔽網(wǎng)絡(luò)爬蟲(chóng)配置示例

 更新時(shí)間:2014年07月23日 08:37:31   投稿:junjie  
這篇文章主要介紹了Nginx限制搜索引擎爬蟲(chóng)頻率、禁止屏蔽網(wǎng)絡(luò)爬蟲(chóng)配置示例,限制爬蟲(chóng)頻率用于一些無(wú)良爬蟲(chóng),禁止爬蟲(chóng)用于一些不需要收錄的網(wǎng)站,需要的朋友可以參考下

復(fù)制代碼 代碼如下:

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

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

超過(guò)設(shè)置的限定頻率,就會(huì)給spider一個(gè)503。
上述配置詳細(xì)解釋請(qǐng)自行g(shù)oogle下,具體的spider/bot名稱(chēng)請(qǐng)自定義。

附:nginx中禁止屏蔽網(wǎng)絡(luò)爬蟲(chóng)

復(fù)制代碼 代碼如下:

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 測(cè)試一下

復(fù)制代碼 代碼如下:
curl -I -A "qihoobot" www.xxx.com

相關(guān)文章

最新評(píng)論

大英县| 丹凤县| 米林县| 凤城市| 嘉义市| 建平县| 永城市| 托克逊县| 陆丰市| 车险| 常宁市| 油尖旺区| 当阳市| 望城县| 正宁县| 泗水县| 封开县| 双牌县| 团风县| 寿光市| 新化县| 莒南县| 宁安市| 新疆| 乌苏市| 卓尼县| 蓬安县| 东安县| 阿荣旗| 筠连县| 确山县| 元江| 江门市| 依兰县| 安塞县| 北流市| 南皮县| 宁强县| 棋牌| 汨罗市| 长武县|