nginx和apache添加brotli算法压缩网站-Linux运维-学派吧
有需要服务器方面的需求和咨询,可以联系博主 QQ 7271895 文章目录[隐藏] 什么是brotli? 安装依赖文件[仅限centos] 编译安装brotli库 apache/nginx添加编译参数 apache/nginx修改配置文件 出错解决办法 什么是brotli? brotli是Google开发的最新压缩算法,有效减少网站传输数据 具体内容请查看WIKI https://en.wikipedia.org/wiki/Brotli 安装依赖文件[仅限centos] yum groupinstall 'Development Tools' -y yum install cmake -y 编译安装brotli库 wget https://github.com/google/brotli/archive/v1.0.3.tar.gz tar -zxvf v1.0.3.tar.gz cd brotli-1.0.3 ./configure-cmake make make test make install apache/nginx添加编译参数 "--enable-brotli" \ "--with-brotli=/usr/local/lib" \ #apache官方模块,依赖brotli库 --add-module=../ngx_brotli-master #添加ngx_brotli模块编译 ngx_brotli模块下载地址 https://github.com/google/ngx_brotli https://github.com/eustas/ngx_brotli apache/nginx修改配置文件 http://httpd.apache.org/docs/2.4/mod/mod_brotli.html apache修改文件 /etc/httpd/conf/extra/httpd-deflate.conf <IfModule brotli_module> SetOutputFilter BROTLI_COMPRESS;DEFLATE SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip no-brotli dont-vary BrotliCompressionQuality 6 BrotliCompressionWindow 18 AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/css text/xml AddOutputFilterByType BROTLI_COMPRESS application/x-javascript application/javascript AddOutputFilterByType BROTLI_COMPRESS application/rss+xml AddOutputFilterByType BROTLI_COMPRESS application/xml AddOutputFilterByType BROTLI_COMPRESS application/json </IfModule> #nginx配置文件 brotli on; brotli_types text/html text/plain text/javascript text/css text/xml text/x-component application/javascript application/x-javascript application/xml application/json application/xhtml+xml application/rss+xml application/atom+xml application/x-font-ttf application/vnd.ms-fontobject image/svg+xml image/x-icon font/opentype; brotli_static off; brotli_comp_level 6; brotli_buffers 8 16k; brotli_window 512k; brotli_min_length 512;...