配置要点
- 开启gzip,请求的资源会在服务端被压缩,传输压缩过的资源,浏览器解压;
- .jpg .gif .png结尾的请求会到/opt/app/code/images下寻找;
- gzip_comp_level值越大,压缩比率越高,越耗性能;
- 对文本压缩效率最高;
location ~ .*\.(jpg|gif|png)$ {
gzip on;
gzip_http_version 1.1;
gzip_comp_level 2;
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;
root /opt/app/code/images;
}