全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 3784|回复: 7
打印 上一主题 下一主题

[lighttpd] Lighttpd 1.4.20 服务端启用GZIP

[复制链接]
跳转到指定楼层
1#
发表于 2009-12-5 16:16:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

打开
/etc/lighttpd/lighttpd.conf

查找
  1. #### compress module
  2. #compress.cache-dir         = "/tmp/lighttpd/cache/compress/"
  3. #compress.filetype          = ("text/plain", "text/html")
复制代码
把前面的注释符号去掉. 需要压缩的文件类型添加在compress.filetype 里
  1. #### compress module
  2. compress.cache-dir         = "/tmp/lighttpd/cache/compress/"
  3. compress.filetype          = ("text/plain", "text/html", "text/javascript", "text/css")
复制代码
文件对应类型
  1.   ".pdf"          =>      "application/pdf",
  2.   ".sig"          =>      "application/pgp-signature",
  3.   ".spl"          =>      "application/futuresplash",
  4.   ".class"        =>      "application/octet-stream",
  5.   ".ps"           =>      "application/postscript",
  6.   ".torrent"      =>      "application/x-bittorrent",
  7.   ".dvi"          =>      "application/x-dvi",
  8.   ".gz"           =>      "application/x-gzip",
  9.   ".pac"          =>      "application/x-ns-proxy-autoconfig",
  10.   ".swf"          =>      "application/x-shockwave-flash",
  11.   ".tar.gz"       =>      "application/x-tgz",
  12.   ".tgz"          =>      "application/x-tgz",
  13.   ".tar"          =>      "application/x-tar",
  14.   ".zip"          =>      "application/zip",
  15.   ".mp3"          =>      "audio/mpeg",
  16.   ".m3u"          =>      "audio/x-mpegurl",
  17.   ".wma"          =>      "audio/x-ms-wma",
  18.   ".wax"          =>      "audio/x-ms-wax",
  19.   ".ogg"          =>      "application/ogg",
  20.   ".wav"          =>      "audio/x-wav",
  21.   ".gif"          =>      "image/gif",
  22.   ".jpg"          =>      "image/jpeg",
  23.   ".jpeg"         =>      "image/jpeg",
  24.   ".png"          =>      "image/png",
  25.   ".xbm"          =>      "image/x-xbitmap",
  26.   ".xpm"          =>      "image/x-xpixmap",
  27.   ".xwd"          =>      "image/x-xwindowdump",
  28.   ".css"          =>      "text/css",
  29.   ".html"         =>      "text/html",
  30.   ".htm"          =>      "text/html",
  31.   ".js"           =>      "text/javascript",
  32.   ".asc"          =>      "text/plain",
  33.   ".c"            =>      "text/plain",
  34.   ".cpp"          =>      "text/plain",
  35.   ".log"          =>      "text/plain",
  36.   ".conf"         =>      "text/plain",
  37.   ".text"         =>      "text/plain",
  38.   ".txt"          =>      "text/plain",
  39.   ".dtd"          =>      "text/xml",
  40.   ".xml"          =>      "text/xml",
  41.   ".mpeg"         =>      "video/mpeg",
  42.   ".mpg"          =>      "video/mpeg",
  43.   ".mov"          =>      "video/quicktime",
  44.   ".qt"           =>      "video/quicktime",
  45.   ".avi"          =>      "video/x-msvideo",
  46.   ".asf"          =>      "video/x-ms-asf",
  47.   ".asx"          =>      "video/x-ms-asf",
  48.   ".wmv"          =>      "video/x-ms-wmv",
  49.   ".bz2"          =>      "application/x-bzip",
  50.   ".tbz"          =>      "application/x-bzip-compressed-tar",
  51.   ".tar.bz2"      =>      "application/x-bzip-compressed-tar"
复制代码

[ 本帖最后由 kok 于 2009-12-5 16:53 编辑 ]

评分

参与人数 2威望 +40 收起 理由
loveloli + 10 学习了
cpuer + 30 感谢分享

查看全部评分

2#
发表于 2009-12-5 16:18:02 | 只看该作者

回复 1# 的帖子

视频文件你都加进去了    视频 音频 图片压缩率很低的,没啥效果。
3#
 楼主| 发表于 2009-12-5 16:19:08 | 只看该作者
原帖由 cpuer 于 2009-12-5 16:18 发表
视频文件你都加进去了    视频 音频 图片压缩率很低的,没啥效果。



没加 只压缩CSS JS HTML
4#
发表于 2009-12-5 16:28:37 | 只看该作者
大哥,这个是设置html txt等文件的压缩,而不是gzip
5#
 楼主| 发表于 2009-12-5 16:29:44 | 只看该作者
原帖由 gg8280525 于 2009-12-5 16:28 发表
大哥,这个是设置html txt等文件的压缩,而不是gzip



?? 为什么我检测了 显示是GZIP 呢?

http://zzbang.cn/tools/gzip/?q=www.sanda8.com


网页原始大小: 12072 字节
压缩后的大小: 3671 字节
网页压缩比率: 70 % (越高越好)
网页压缩类型: 采用了gzip方式
压缩提醒建议: VERY GOOD, 压缩得非常完美!


http://www.cyberciti.biz/tips/li ... ssion-tutorial.html

额 英语很差 用的翻译工具...

[ 本帖最后由 kok 于 2009-12-5 16:33 编辑 ]
6#
发表于 2009-12-5 19:06:11 | 只看该作者

回复 5# 的帖子

之前检测是否有gzip压缩?
7#
发表于 2009-12-5 19:17:51 | 只看该作者
谢谢了
8#
 楼主| 发表于 2009-12-5 20:11:04 | 只看该作者
原帖由 cpuer 于 2009-12-5 19:06 发表
之前检测是否有gzip压缩?



之前没有...
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-5-4 19:48 , Processed in 0.137133 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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