配置
-
# 判断 pc 和 mobile 的 H5 -
location / { -
set $is_mobile false; #设置一个初始值 -
if ( $http_cookie ~* "ACCESS_TERMINAL=mobile" ) { #判断匹配手机端 -
set $is_mobile true; -
} -
if ($http_user_agent ~* (android|ip(ad|hone|od)|kindle|blackberry|windows\s(ce|phone))) { #匹配手机端类型 -
set $is_mobile true; -
} -
if ($is_mobile = true) { -
root /usr/local/openresty/nginx/html/mobile/; -
break; -
} -
root /usr/local/openresty/nginx/html/pc/;