加速网站静态资源访问
我们之前通过采用淘宝的以下2个Nginx模块,对网站的静态资源访问进行了加速处理
ngx_http_concat_module
可参考:
http://tengine.taobao.org/document_cn/http_concat_cn.html
ngx_http_trim_filter_module
http://tengine.taobao.org/document_cn/http_trim_filter_cn.html
现在我们在原有的基础上,通过在Nginx层增加gzip压缩功能,进一步提升网站静态资源的访问速度。
在 nginx.conf 主配置的http块中,增加以下配置:
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml application/javascript p_w_picpath/jpeg p_w_picpath/gif p_w_picpath/png;
gzip_vary on;
测试如下:
转载于:https://blog.51cto.com/sofar/1366529