分类

链接

2024 年 7 月
1234567
891011121314
15161718192021
22232425262728
293031  

近期文章

热门标签

新人福利,免费薅羊毛

现在位置:    首页 > Others > 正文
nginx自动切换到手机/PC 网站
Others 暂无评论 阅读(32)
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;
    }
     
 
}

 

============ 欢迎各位老板打赏~ ===========

本文版权归Bruce's Blog所有,转载引用请完整注明以下信息:
本文作者:Bruce
本文地址:nginx自动切换到手机/PC 网站 | Bruce's Blog

发表评论

留言无头像?