server {
    listen       82;
    server_name  localhost; 
	location / { 
		index  index.html index.htm;
		set $is_mobile 0;
		if ($http_user_agent ~* (mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)) {
			set $is_mobile 1;
		}
		# PC端
		if ($is_mobile = 0) {
		   root D:/env/nginx-1.18.0/html/pc;
		}
		# 移动端
		if ($is_mobile = 1) {
			root D:/env/nginx-1.18.0/html/mobile;
		}
	}
}

 

最后修改于 2021-12-22 10:23:25
如果觉得我的文章对你有用,请随意赞赏
扫一扫支付
上一篇