Nginx多端适配
通过nginx获取用户设备的Agent来判断
# 多端适配
server {
listen 7000;
server_name zhhll.icu;
location / {
root /Users/zhanghe/Desktop/nginx;
# 1.如果是静态页面判断agent如果是移动端则指向移动端
# 2.pc和m端是两个服务,可以通过proxy_pass反向代理到对应的服务
if ($http_user_agent ~* '(Android|webOS|iPhone|iPod|BlackBerry)') {
root /Users/zhanghe/Desktop/nginx-demo/mob;
}
index index.html index.htm;
}
}
https://zhhll.icu/2023/服务器/Nginx/17.Nginx多端适配/
本文由mdnice多平台发布
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。