nginx 手机版页面判断_nginx 通过user-agent判断是手机的浏览器
user-agent 收集:
nginx
add_header X-Frame-Options SAMEORIGIN;
server {
listen 80;
server_name www.baidu.com;
client_max_body_size 10M;
rewrite ^(.*)$ https://$host$1 permanent;
}
server {
listen 443 ssl;
server_name djzl.pj.gov.cn;
client_max_body_size 10M;
ssl_certificate /usr/local/ssl/https_pj_gov_cn0119/_pj_gov_cn.crt;
ssl_certificate_key /usr/local/ssl/https_pj_gov_cn0119/_pj_gov_cn.key;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location = / {
if ($http_user_agent ~* "Nokia") {
rewrite . /index.html break;
}
if ($http_user_agent ~* "MicroMessenger") {
rewrite ^/(.*) https://wxaurl.cn/AXzQitDTSBc permanent break;
}
rewrite ^/(.*) https://www.baidu.com permanent;
}
}
|