nginx 開啓gzip 壓縮資源

upstream sems {
    server 127.0.0.1:10171 weight=1 fail_timeout=0;
}

server {
    listen 80;
    server_name www.serve.com;

    location / {
        proxy_pass http://sems/dist/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP        $remote_addr;
        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;

        gzip on;
        gzip_comp_level 6; # 壓縮比例,比例越大,壓縮時間越長。默認是1
        gzip_types text/xml text/plain text/css application/javascript application/x-javascript application/rss+xml; # 哪些文件能夠被壓縮
        gzip_disable "MSIE [1-6]\."; # IE6無效
    }

}


                              
                            
相關文章
相關標籤/搜索