1、修改配置 打开 nginx 的配置文件sudo nano /etc/nginx/nginx.conf,找到 gzip 对应区域,增加下面...
gzip_http_version 1.1; gzip_types text/plain text/html text/css application/jsonapplication/javascripttext/xml application/xml application/xml+rss text/javascript;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png application/vnd.ms-fontobject font/ttf font/opentype font/x-woff image/svg+xml; # 是否在http header中添加Vary: Accept-Encoding,建议...
主要是为了兼容不支持gzip压缩的浏览器,比如IE6,不过IE6早就废弃了。 嵌入变量 该gzip压缩模块嵌入了一个变量$gzip_ratio,可以在配置文件中使用,通过该变量,可以获取压缩的比例,即原始大小和压缩后响应大小的比例。
但是PageSpeed监测网页性能,gzip并没有生效 仔细查看了一番文件的Content-Type: appliacation/javascript在gizp的压缩类型种并不存在,所以在配置中加上这个类型。 gzip on;gzip_disable"msie6";gzip_vary on;gzip_proxied any;gzip_comp_level6;gzip_buffers168k;gzip_http_version1.1;gzip_types text/plain text/...
需要使用http_gzip_static_module这个模块,进行pre-compress。 具体方法如下: ngx_http_gzip_static_...
问题很明显啊,现在哪个浏览器还用http1.0呢?
gzip_types application/atom+xml # 这个application/x-javascript还是有区别的 application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/...
I would open a PR that adds gzip on above gzip_types, but I note that gzip_proxied must also be set to something other than its default of off for gzip to actually be enabled; there are several options (http://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip_proxied) and it...