MW面板|openresty添加br压缩

一、前言

 br压缩明显优于Gzip压缩、对速度和性能都有较大提升
 个人使用面板为mdserver-web,加之使用openresty而非nginx,模块理论需要手动安装,于是这个教程诞生了、偏小白向

二、下载br压缩,修改安装脚本

 首选下载br模块到服务器,推荐直接进入命令行按顺序输入以下内容

cd /www
git clone https://github.com/google/ngx_brotli.git
cd ngx_brotli
git submodule update --init


 完成以上操作后修改openresty安装脚本 /www/server/mdserver-web/plugins/openresty/install.sh
 在 --with-http_realip_module 后添加\并在下一行加入如下内容

--add-module=/www/ngx_brotli

三、重装openresty并启用br模块

 在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;

四、检测br压缩是否成功

推荐网站Gift of Speed



文章目录