如何启用/ 安装Brotli (我的是军哥lnmp1.8)
cd /root/lnmp1.8/src/
git clone https://github.com/google/ngx_brotli.git
cd ngx_brotli
git submodule update --init
cd /root/lnmp1.8
./upgrade.sh nginx
Nginx_Modules_Options='--with-http_realip_module --with-stream_ssl_preread_module --add-module=/root/lnmp1.8/src/ngx_brotli'
PHP_Modules_Options=''
配置Nginx的全局配置文件
Nginx http 配置段中适当的位置添加
brotli on;
brotli_comp_level 6;
brotli_static on;
brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
Chrome 浏览器 F12 打开 开发者工具
切换到 Network—Ctrl+F5
点击选择主页地址
选择右边栏目的Headers
Headers栏目下方的Response Headers 中出现有 content-encoding: br 表示开启Brotli成功
https://github.com/google/ngx_brotli