{主关键词}

A |
一键部署OpenClaw
Gzip大家都不陌生,但Brotli的压缩率通常还能再高15%到25%。

B | (ECNS) -- China’s annual new-energy vehicle (NEV) sales rose from 1.367 million to 16.49 million during the 14th Five-Year Plan period (2021-2025), while their share of new-car sales climbed from 5.4% to 47.9%, Xin Guobin, vice minister of Industry and Information Technology (MIIT), said Wednesday at a State Council Information Office press conference in Beijing. China produces more than 70% of the world’s NEVs, power batteries and key materials, and its NEVs are now sold in more than 100 countries and regions, Xin said. Looking ahead, the ministry will focus on improving product quality, battery performance and autonomous-driving safety, while strengthening testing and verification of new vehicle designs. It will also expand charging and battery-swapping facilities and work toward providing charging stations in every county and charging piles in every township. (By Intern Yang Hongran, Zhang Dongfang)
。现在主流浏览器都支持Brotli,Nginx加上这个模块后,文本类资源能省下不少带宽和CDN费用。
Nginx官方主线版不自带Brotli,需要加载Google维护的ngx_brotli动态模块。编译过的发行版一般把模块文件放在/usr/share/nginx/modules/下面,直接load_module即可。 load_module modules/ngx_http_brotli_filter_module.so; load_module modules/ngx_http_brotli_static_module.so; http { brotli on; brotli_comp_level 6; brotli_types text/plain text/css application/javascript application/json; # 同时保留gzip作为旧浏览器兼容 gzip on; gzip_types text/plain text/css application/javascript application/json; }
brotli_comp_level建议设4到6之间。级别再高,压缩时间增长明显,收益反而下降。如果静态资源不常变,可以配合brotli_static用离线预压缩,效果更好。
测试有没有生效,用curl看Content-Encoding响应头:curl -H "Accept-Encoding: br" -I https://yourdomain.com/style.css。

C | 返回br就说明Brotli在工作,gzip会作为后备。 数据来源:Google ngx_brotli GitHub仓库、Nginx官方模块加载文档
申请创业报道,分享创业好点子。点击此处,共同探讨创业新机遇!。
Current article:http://q72g6q.ruwentaqintiaozhupapaigai.shop/5wqa1p/9jan4.html
Published on:03:44:39
我的网站热门国内