if ($http_user_agent ~* baidu|spider sorry, it need to add ")". It's if ($http_user_agent ~* baidu|spider) Posted at Nginx Forum: http://forum.nginx.org/read.php?2,3114,3130#msg-3130