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

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

 更新時(shí)間:2014年07月23日 08:37:31   投稿:junjie  
這篇文章主要介紹了Nginx限制搜索引擎爬蟲頻率、禁止屏蔽網(wǎng)絡(luò)爬蟲配置示例,限制爬蟲頻率用于一些無良爬蟲,禁止爬蟲用于一些不需要收錄的網(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;
}

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

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

復(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)論

皮山县| 吉水县| 大渡口区| 扶余县| 招远市| 礼泉县| 巴南区| 会东县| 北海市| 海阳市| 手游| 仁寿县| 九江市| 台东市| 永年县| 南宫市| 新安县| 芜湖市| 岳普湖县| 基隆市| 革吉县| 锡林郭勒盟| 阿克| 盐边县| 北安市| 雷州市| 霸州市| 平舆县| 柳林县| 青州市| 沅陵县| 华坪县| 苗栗市| 乌审旗| 嵊州市| 博兴县| 和顺县| 新邵县| 临桂县| 米易县| 苗栗县|