Nginx启用GZIP压缩网页传输方法
来源:互联网 发布:手机淘宝网司法拍卖网 编辑:程序博客网 时间:2024/05/20 19:48
原理:
浏览器—请求—-> 声明可以接受 gzip压缩 或 deflate压缩 或compress 或 sdch压缩
从http协议的角度看–请求头 声明 acceopt-encoding: gzip deflate sdch (是指压缩算法,其中sdch是google倡导的一种压缩方式,目前支持的服务器尚不多)
服务器–>回应—把内容用gzip方式压缩—->发给浏览器
浏览<—–解码gzip—–接收gzip压缩内容—-
gzip配置的常用参数
conf/mime.types
文件 gzip_vary on/off 是否传输gzip压缩标志注意:
图片/mp3这样的二进制文件,不必压缩
因为压缩率比较小, 比如100->80字节,而且压缩也是耗费CPU资源的.
比较小的文件不必压缩,
例子:
server {listen 80; #监听端口server_name localohst; #监听域名gzip on; #开启gizipgzip_buffers 32 4K;#压缩在内存中缓冲32块 每块4Kgzip_comp_level 6 ;#压缩级别 推荐6gzip_min_length 4000;#开始压缩的最小长度4bitgzip_types text/css text/xml apploation/x-javascript;#只对CSS、XML、JS文件进行压缩。 默认压缩text/html 不需要指定,否则报错location / {root /var/www/a.com; #根目录定位index index.html;}}
0 0
- Nginx启用GZIP压缩网页传输方法
- Apache启用GZIP压缩网页传输方法
- Apache启用GZIP压缩网页传输方法
- apache启用gzip压缩方法
- apache启用gzip压缩方法
- apache启用gzip压缩方法
- apache启用gzip压缩方法
- apache启用gzip压缩方法
- Nginx 网页压缩传输
- nginx开启网页压缩--Gzip
- 启用nginx 的gzip压缩功能
- nginx启用gzip压缩的示例
- nginx启用gzip压缩js等文件
- 网页启用Gzip压缩 提高浏览速度
- 网页启用Gzip压缩 提高浏览速度
- 网页启用Gzip压缩 提高浏览速度
- 开启apache或nginx网页gzip压缩
- nginx开启GZIP来压缩网页
- 寻找你的热情(1)——检查自己所处的位置
- cuda 计算能力查询表
- 网络知识
- QT窗体间传值之全局变量
- Nim Game
- Nginx启用GZIP压缩网页传输方法
- ActiveMQ
- 稻盛和夫 活法
- [计算几何][凸包][旋转卡壳] 最远距离点对
- MySQL实现Oracle的row_number()over(partition by)
- Qt窗体间传值之public函数接口
- AngularJS基础讲解-AngularJS简介
- mysql 常用update语句
- 基础练习 阶乘计算