56 Nginx中gzip_static使用测试

56 Nginx中gzip_static使用测试

56.1 访问1

浏览器访问:http://10.0.0.100/jquery.js ,没有压缩 249KB

image

# Response Headers 中内容
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Sat, 16 May 2026 09:40:18 GMT
Content-Type: application/javascript
Content-Length: 248940
Last-Modified: Thu, 14 May 2026 08:55:52 GMT
Connection: keep-alive
ETag: "6a058e18-3cc6c"
Accept-Ranges: bytes

56.2 访问2

[root@nginx-100 ~]# cd /usr/local/nginx/html/
[root@nginx-100 /usr/local/nginx/html]# gzip jquery.js 
[root@nginx-100 /usr/local/nginx/html]# ls -ltr
total 20
-rw-r--r-- 1 root root  643 Mar 15 21:05 index.html
-rw-r--r-- 1 root root  532 Mar 25 18:55 50x.html
-rw-r--r-- 1 root root   30 Mar 25 18:58 welcome.html
drwxr-xr-x 2 root root   20 May 13 11:01 images
-rw-r--r-- 1 root root 7435 May 14 16:55 jquery.js.gz

浏览器访问:http://10.0.0.100/jquery.js ,压缩后 7.7KB

image

# Response Headers 中内容
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Sat, 16 May 2026 09:43:38 GMT
Content-Type: application/javascript
Content-Length: 7435
Last-Modified: Thu, 14 May 2026 08:55:52 GMT
Connection: keep-alive
Vary: Accept-Encoding
ETag: "6a058e18-1d0b"
Content-Encoding: gzip

 

———————————————————————————————————————————————————————————————————————————

                                                                                                                         无敌小马爱学习

posted on 2026-05-16 00:13  马俊南  阅读(5)  评论(0)    收藏  举报