建议OpenResty镜像打包Brotli压缩模块

Brotli压缩的效率平均可以比Gzip提升20%的压缩率,同时对于服务器的性能损耗非常低
目前主流的CDN平台基本已经默认启用Brotli,而目前在OpenResty中引入只需要两个文件即可。
/usr/local/openresty/nginx/modules/下放置ngx_http_brotli_filter_module.so以及ngx_http_brotli_static_module.so文件,同时在/opt/1panel/apps/openresty/openresty/conf/nginx.conf头部加入

load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;

即可顺利进行引入
由于该压缩方式市场占有率极高且引入方式非常简单,建议1Panel在OpenResty的镜像中进行引入,同时对应处理下nginx.conf配置文件,以达到默认使用的目的。

brotli on;
brotli_comp_level 9;
brotli_static on;
brotli_types application/atom+xml application/javascript application/json application/vnd.api+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;

两个模块文件的编译方式可以参考https://github.com/google/ngx_brotli 或者 1panel中的OpenResty启用Brotli压缩 - 神楽坂 玉兔

2 个赞

支持!…. :grinning:

1 个赞

支持! :star_struck:

1 个赞