Nginx使用brotli代替gzip
最近幾年出現了很多新的壓縮算法, 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
總結
以上是生活随笔為你收集整理的Nginx使用brotli代替gzip的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: swift源代码兼容开源项目清单
- 下一篇: Nginx 模块开发