本坛的 brotli 支持? 阅读:4890回复:24
友坛增加了 brotli 支持
https://vivaldi.club/d/489 firefox 从 44 开启 brotli 支持 bug 366559 nginx https://trac.nginx.org/nginx/ticket/798 参考阅读 https://hacks.mozilla.org/2015/11/better-than-gzip-compression-with-brotli/ https://textplain.wordpress.com/2015/09/10/brotli/ |
|
|
论坛程序不一样吧,老实说phpwind基本半死,估计是没法支持brotli。@fiag
|
|
|
|
|
http://caniuse.com/brotli
目前就 firefox 主动开启 blink 及壳需要手动开启一个 flag 的 google 的模块已经处理了对 Accept-Encoding 头的检测 当且仅当包含 br 时才做压缩 总之 坐等 |
|
|
搞定了 ebuild
https://github.com/fiag/nginx-overlay 试试看开启了会怎么样 css, js 已经 br 了。但 html 还是 gzip, 这个怎么解? brotli on; brotli_static on; brotli_types application/xml text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon; |
> curl https://www.firefox.net.cn/ -H "Accept-Encoding: br" -D - -s -o /dev/null HTTP/1.1 200 OK Server: nginx Date: Sun, 27 Mar 2016 14:11:48 GMT Content-Type: text/html;charset=utf-8 略 Content-Encoding: br https://github.com/google/ngx_brotli/ Enables on-the-fly compression of responses for the specified MIME types in addition to text/html. The special value * matches any MIME type. Responses with the text/html MIME type are always compressed.看来是 phpwind 主动编码的? 服务器上放个静态的 html 页面测试下就知道了…… |
|
|
> curl https://www.firefox.net.cn/themes/forum/default/template/bbs/thread_run.htm -H "Accept-Encoding: gzip, deflate, br" -D - -s -o /dev/null HTTP/1.1 200 OK Server: nginx Date: Sun, 27 Mar 2016 14:33:55 GMT Content-Type: text/html 略 Content-Encoding: br看来还真是 phpwind 主动做了编码 后台有设置可以取消么? https://www.google.com/search?q=gzip+site%3Aphpwind.net 可以确定是 phpwind 的锅了 |
|
|
aaaa007cn:> curl https://www.firefox.net.cn/themes/forum/default/template/bbs/thread_run.htm -H "Accept-Encoding: gzip, deflate...回到原帖搞定 管理后台没找到,只有修改代码了。 http://www.phpwind.net/read/2849167 conf/application/default.php 'web-apps' => array( 'default' => array( 'charset' => 'utf-8', 'error-dir' => 'TPL:common.windweb', 'compress' => false ) )这参数藏的好深。 |
fiag:搞定 以论坛首页为例,包括所有 js 脚本、样式表 gzip 编码后共 79,058 字节 brotli 编码后共 74,141 字节 节省 4.8 KB 其中首页本身为 php 动态生成的 gzip 4,762 字节 vs brotli 4,203 字节 参考 Nick Desaulniers 的数据 或许只对 pre-compressed 的静态内容(不经常改动的 js 脚本、样式表)开启 brotli 比较好? 毕竟 on the fly 编码还是挺吃 cpu 的 不过对于页面比较大的 比如 https://www.firefox.net.cn/read-43130 页面本身 137,619 字节 gzip 30,238 字节 brotili 25,290 字节 效果很明显 |
|
|