Nginx 屏蔽搜索引擎蜘蛛

分类:CentOS运维 阅读:81630 次

将代码加入不让蜘蛛抓取的段内

if ($http_user_agent ~* (baiduspider|googlebot|soso|bing|sogou|yahoo|sohu-search|yodao|YoudaoBot|robozilla|msnbot|MJ12bot|NHN|Twiceler)){ retur 403; }

放入server段内则全站生效,放在location则只有对应的段生效对其他独立的location段无影响.