Nginx使用brotli代替gzip

来源:互联网 发布:淘宝动漫壁纸店铺推荐 编辑:程序博客网 时间:2024/06/11 00:42

最近几年出现了很多新的压缩算法, brotli是google开源的新的压缩算法之一,我的另外一篇文章做了一下收集整理。

http://blog.csdn.net/chenhaifeng2016/article/details/62040026


本文主要描述Nginx使用brotli代替gzip.

首先下载brotli的nginx模块

cd /usr/local/src

git clone https://github.com/google/ngx_brotli.git


接着下载brotli源代码

cd ngx_brotli

cd deps/brotli

git clone https://github.com/google/brotli.git


编译nginx源代码指定第三方模块

./configure --prefix=/usr/local/nginx --add-module=/usr/local/src/ngx_brotli

make

make install


配置nginx.conf

brotli on;

brotli_comp_level 6;

brotli_buffers 16 8k;

brotli_min_length 20;

broli_types *;


反向代理禁用gzip

proxy_set_header Accept-Encoding "";


浏览器兼容性chrome, 只对https生效



强烈 推荐

https://engineering.linkedin.com/blog/2017/05/boosting-site-speed-using-brotli-compression


0 0
原创粉丝点击