VPS侦探论坛

 找回密码
 注册
查看: 4115|回复: 1

求解怎么开启对JS,CSS,图片的压缩?

[复制链接]
发表于 2015-5-15 09:15:47 | 显示全部楼层 |阅读模式

在配置文件中已经更改

                gzip on;
                gzip_min_length  1k;
                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 [1-6].";

本来以为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。求解如何打开呢,谢谢
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2015-5-15 16:42:43 | 显示全部楼层


你curl 的信息已经显示Content-Type: application/javascript 是这种类型,你要加上application/javascript再重启nginx就行了
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-27 17:25 , Processed in 0.025674 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表