nginx 区分手机浏览器和pc浏览器
可以通过nginx 区分手机浏览器和pc浏览器,需要在nginx.conf 的sever 中配置项目的内容
server {
set $mobile 0;
if ( $http_user_agent ~* "(Android|iPhone|Windows Phone|UC|Kindle)" ){
set $mobile "${mobile}1";
}
if ( $http_host !~ "192.168.1.220" ){
set $mobile "${mobile}2";
}
if ( $cookie_vmod !~ "pc" ){
set $mobile "${mobile}3";
}
if ( $mobile = "0123" ){
//手机浏览器
rewrite ^/(.*)$ http://192.168.1.220/$1 last;
break;
}
//电脑ie
proxy_pass http://pc_server;
break;
}
相关推荐
nginxs 2020-11-14
Guanjs0 2020-11-13
小木兮子 2020-11-11
yserver 2020-11-11
ssihc0 2020-11-11
windle 2020-11-10
HanksWang 2020-11-10
liuchen0 2020-11-10
Freshairx 2020-11-10
ccschan 2020-11-10
liwf 2020-11-10
Guanjs0 2020-11-09
AderStep 2020-11-09
zrtlin 2020-11-09
mqfcu 2020-11-10
windle 2020-10-29