nginx 判断移动端或者 PC 端 进入不同项目
server {
listen 80;
server_name xxx.com;
root "/var/www/public";
location / {
#默认PC端访问内容
root "/var/www/public";
#如果是手机移动端访问内容
if ($http_user_agent ~* "(mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)") {
root "/var/www/mobile";
}
index index.html index.php;
}
}
本作品采用《CC 协议》,转载必须注明作者和本文链接
推荐文章: