location / {
#pc端内容访问
set $flag "pc";
set $num 1;
set $hua "${http_user_agent}";
set $iospad "${http_user_agent}";
set $androidpad "${http_user_agent}";
#mobile端访问内容
if ( $http_user_agent ~* "Mobile") {
set $flag "mobile";
}
#ios-pad端访问内容
if ( $iospad ~* "iPad|ipad") {
set $flag "pad";
}
#android-pad端访问内容
if ( $androidpad ~* "Android") {
set $num "${num}2";
}
if ( $hua !~* "Mobile") {
set $num "${num}3";
}
if ( $num = "123") {
set $flag "pad";
}
root /usr/local/etc/nginx/website/$flag;
index index.html index.htm;
}