可以这么配置,应该还有更好的写法。
location /log {
if ($http_user_agent ~ MSIE ) {
access_log /var/log/msie.log;
}
if ($http_user_agent ~ Opera ) {
access_log /var/log/opera.log;
}
if ($http_user_agent ~ Webkit ) {
access_log /var/log/webkit.log;
}
if ($http_user_agent ~ Mozilla ) {
access_log /var/log/mozilla.log;
}
add_header "Content-Type" "text/plain;charset=UTF-8";
return 200 "$http_user_agent";
}