nginx通过不同客户端类型匹配不同首页
server {
listen 80;
server_name www.google.com;
if ($http_user_agent ~* “Android”) {
set $mobile 1;
}
if ($http_user_agent ~* “iPhone”) {
set $mobile 1;
}
if ($mobile = 1) {
set $index_file ./Mobile/index.html;
}
if ($mobile != 1) {
set $index_file ./Computer/index.html;
}
location / {
root /data/html/;
index $index_file;
}
}