Nginx判断手机还是PC跳转

  • Post author:
  • Post category:其他


server {


listen       80;

server_name  localhost;

#charset koi8-r;

#access_log  logs/host.access.log  main;

location /api {


proxy_pass http://localhost:8769;

}

location / {

root html/home;

if ($http_user_agent ~* “(mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)”) {


root html/mobile;

}

try_files $uri $uri/ /index.html;

}

error_page   500 502 503 504  /50x.html;

location = /50x.html {


root   html;

}

}