配置

 
  1. # 判断 pc 和 mobile 的 H5

  2. location / {

  3. set $is_mobile false; #设置一个初始值

  4.  
  5. if ( $http_cookie ~* "ACCESS_TERMINAL=mobile" ) { #判断匹配手机端

  6. set $is_mobile true;

  7. }

  8. if ($http_user_agent ~* (android|ip(ad|hone|od)|kindle|blackberry|windows\s(ce|phone))) { #匹配手机端类型

  9. set $is_mobile true;

  10. }

  11. if ($is_mobile = true) {

  12. root /usr/local/openresty/nginx/html/mobile/;

  13. break;

  14. }

  15. root /usr/local/openresty/nginx/html/pc/;

  16.