mw面板|openresty添加br压缩

ECHSFXY (UID: 4466) 5月前

501 1

原文https://echs.top/art/109

前言

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

 

echs.top
已有评论 (1)
  • ECHSFXY (UID: 4466) @Ta
    5月前 (echs.top)
    1
    加菲酷猫 学习到了,等会就换这个压缩算法,看百度文章,总体压缩率提升了不少了。

    优点:压缩快、压缩度高、延迟低

    缺点:占用高、对cpu要求高

    • 大佬论坛
      2
      登录后才可回帖  登录 注册

本站同款香港KC服务器 酷盾安全联盟 智能优化防护 ROOVPS 便宜服务器 盾云SCDN 月付只需1元起