手机端、PC端自动匹配nginx配置

    listen       80;
    server_name  localhost;

    location ~ ^/(fs|trip) {
        proxy_pass http://XXXXX;
        proxy_redirect off;
        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 30s;
        proxy_read_timeout 300s;
        proxy_buffers 32 64k;
        proxy_buffer_size 64k;
        index index.html index.htm;
    }

    location ~ ^/(admin) {
        root  /server/nginx/html_trip;
        index index.html index.htm;
        try_files $uri $uri/ /index.html;    #解决h5刷新bug
    }

    location / {      
        root  /server/nginx/html_trip/wedding;
        if ($http_user_agent ~* "^(.*android.*)|(.*iphone.*)|(.*windows phone.*)$"){
            root  /server/nginx/html_trip/wedding_h5;
        }        
    index  index.html index.htm;
    try_files $uri $uri/ /index.html;
    }
 

你可能感兴趣的:(服务器部署)