求解怎么开启对JS,CSS,图片的压缩?
在配置文件中已经更改gzip on;
gzip_min_length1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/javascript text/css application/xml image/gif;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE .";
本来以为application/x-javascript会不行,所以加上了一个application/javascript 。用curl检测
HTTP/1.1 200 OK
Server: nginx/1.6.0
Date: Fri, 15 May 2015 01:05:26 GMT
Content-Type: application/javascript
Content-Length: 95821
Last-Modified: Mon, 04 May 2015 05:42:08 GMT
Connection: keep-alive
ETag: "554706b0-1764d"
Expires: Fri, 15 May 2015 13:05:26 GMT
Cache-Control: max-age=43200
Accept-Ranges: bytes
gzip失败。只能php文件会打开gzip。求解如何打开呢,谢谢 你curl 的信息已经显示Content-Type: application/javascript 是这种类型,你要加上application/javascript再重启nginx就行了
页:
[1]