nginx自动切换到手机/PC 网站
server { listen 80; listen 443 ssl http2; server_name www.xxx.com; ssl_certificate /usr/local/nginx/conf/ssl/xxx.com.pem; ssl_certificate_key /usr/local/nginx/conf/ssl/xxx.com.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; error_page 497 https://$host$request_uri; #charset koi8-r; #access_log logs/host.access.log main; set $target 'http://127.0.0.1:8001'; if ( $http_user_agent ~* "Mobile") { set $target 'http://127.0.0.1:8002'; } location / { proxy_pass $target; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 15s; proxy_send_timeout 15s; proxy_read_timeout 15s; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
============ 欢迎各位老板打赏~ ===========
与本文相关的文章
- · vue3+vite+多环境发面到二级目录配置
- · nginx http转https, 不带www转带www
- · nginx主动健康检查负载均衡模块
- · 使用tengine代替Nginx
- · nginx添加nginx_upstream_check_module
- · nginx上传文件超出默认大小限制,提示:413 Request Entity Too Large
- · nginx反向代理禁用缓存
- · docker nginx
- · consul+nginx完成集群服务动态发现和健康检查
- · nginx使用stream模块做ssh转发
- · nginx反向代理wss
- · nginx+keepalive负载均衡高可用