本网站使用 cookie 以确保您在我们的网站上获得最佳体验。通过使用我们的网站,您承认您已阅读并理解我们的隐私政策。
原文https://echs.top/art/109
br压缩明显优于Gzip压缩、对速度和性能都有较大提升
个人使用面板为mdserver-web,加之使用openresty而非nginx,模块理论需要手动安装,于是这个教程诞生了、偏小白向。
首选下载br模块到服务器,推荐直接进入命令行按顺序输入以下内容
cd /www git clone https://github.com/google/ngx_brotli.git cd ngx_brotli git submodule update --init
/www/server/mdserver-web/plugins/openresty/install.sh
在 --with-http_realip_module 后添加\并在下一行加入如下内容
--with-http_realip_module
--add-module=/www/ngx_brotli
在mdserver-web面板中卸载openresty并重装、或直接安装openresty即可
在OpenResty-设置-配置修改 中添加如下内容(根据服务器情况修改压缩等级、推荐4或6)以启用br压缩
brotli on; brotli_comp_level 6; brotli_static on; brotli_types application/atom+xml application/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype application/x-font-ttf application/x-javascript application/xhtml+xml application/xml font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml;
推荐网站Gift of Speed
学习到了,等会就换这个压缩算法,看百度文章,总体压缩率提升了不少了。
不错
加菲酷猫 学习到了,等会就换这个压缩算法,看百度文章,总体压缩率提升了不少了。
优点:压缩快、压缩度高、延迟低
缺点:占用高、对cpu要求高
ECHSFXY 优点:压缩快、压缩度高、延迟低 缺点:占用高、对cpu要求高
已经换br了,不过中途出了点问题,需要回滚旧一点的版本br才能正常编译,设置的6级,11级没敢开,速度总体上分析了下,确实提升了20多左右,主要css和js、html加载更快了。