通過Nginx訪問的靜態文件下載到瀏覽器客戶端超過10秒,這時候要注意是否進行了gzip壓縮,看響應頭response header
具體設置如下:
server { listen 80; server_name abc.baidu.com; root /etc/nginx/html/h5; index index.html; gzip on; gzip_buffers 32 4K; gzip_comp_level 6; gzip_min_length 100; gzip_types application/javascript text/css text/xml; gzip_disable "MSIE [1-6]\."; location ~ ^/MP_verify.*\.txt$ { root /data/h5/; index index.html; } location / { try_files $uri $uri/ @router; index index.html; } location @router { rewrite ^.*$ /index.html last; } }