nginx限制ua访问和允许特定ua访问

允许特定ua:
if ($http_user_agent !~* "Mozilla/4.0\ \(compatible;\ MSIE 6.0;\ Windows\ NT\ 5.1\)"){
     return 403;
}
限制特定ua:
if ($http_user_agent ~* "Mozilla/4.0\ \(compatible;\ MSIE 6.0;\ Windows\ NT\ 5.1\)"){
     return 403;
}

转载请注明出处 智博小宇 » nginx限制ua访问和允许特定ua访问