PHP程序员站--PHP编程开发平台
 当前位置:主页 >> 服务器 >> 其他服务器 >> 

Lighttpd1.4.20服务端启用GZIP压缩

Lighttpd1.4.20服务端启用GZIP压缩

来源:phperz.com  作者:phperz.com  发布时间:2011-12-25
打开 /etc/lighttpd/lighttpd.conf 查找 #### compress module #compress.cache-dir = /tmp/lighttpd/cache/compress/ #compress.filetype = (text/plain, text/html) 把前面的注释符号去掉. 需要压缩的文件类型添加在compress.filetype 里 #### compress module compr

打开
/etc/lighttpd/lighttpd.conf
查找

#### compress module
#compress.cache-dir         = "/tmp/lighttpd/cache/compress/"
#compress.filetype          = ("text/plain", "text/html")

把前面的注释符号去掉. 需要压缩的文件类型添加在compress.filetype 里

#### compress module
compress.cache-dir         = "/tmp/lighttpd/cache/compress/"
compress.filetype          = ("text/plain", "text/html", "text/javascript", "text/css", "text/javascript")

重启lighttpd
/etc/init.d/lighttpd restart
service lighttpd restart

compress.filetype文件对应类型如下:

  ".pdf"          =>      "application/pdf",
  ".sig"          =>      "application/pgp-signature",
  ".spl"          =>      "application/futuresplash",
  ".class"        =>      "application/octet-stream",
  ".ps"           =>      "application/postscript",
  ".torrent"      =>      "application/x-bittorrent",
  ".dvi"          =>      "application/x-dvi",
  ".gz"           =>      "application/x-gzip",
  ".pac"          =>      "application/x-ns-proxy-autoconfig",
  ".swf"          =>      "application/x-shockwave-flash",
  ".tar.gz"       =>      "application/x-tgz",
  ".tgz"          =>      "application/x-tgz",
  ".tar"          =>      "application/x-tar",
  ".zip"          =>      "application/zip",


  ".mp3"          =>      "audio/mpeg",
  ".m3u"          =>      "audio/x-mpegurl",
  ".wma"          =>      "audio/x-ms-wma",
  ".wax"          =>      "audio/x-ms-wax",
  ".ogg"          =>      "application/ogg",
  ".wav"          =>      "audio/x-wav",
  ".gif"          =>      "image/gif",
  ".jpg"          =>      "image/jpeg",
  ".jpeg"         =>      "image/jpeg",
  ".png"          =>      "image/png",
  ".xbm"          =>      "image/x-xbitmap",
  ".xpm"          =>      "image/x-xpixmap",
  ".xwd"          =>      "image/x-xwindowdump",
  ".css"          =>      "text/css",
  ".html"         =>      "text/html",
  ".htm"          =>      "text/html",


  ".js"           =>      "text/javascript",
  ".asc"          =>      "text/plain",
  ".c"            =>      "text/plain",
  ".cpp"          =>      "text/plain",
  ".log"          =>      "text/plain",
  ".conf"         =>      "text/plain",
  ".text"         =>      "text/plain",
  ".txt"          =>      "text/plain",

  ".dtd"          =>      "text/xml",
  ".xml"          =>      "text/xml",
  ".mpeg"         =>      "video/mpeg",
  ".mpg"          =>      "video/mpeg",
  ".mov"          =>      "video/quicktime",
  ".qt"           =>      "video/quicktime",
  ".avi"          =>      "video/x-msvideo",
  ".asf"          =>      "video/x-ms-asf",


  ".asx"          =>      "video/x-ms-asf",
  ".wmv"          =>      "video/x-ms-wmv",
  ".bz2"          =>      "application/x-bzip",
  ".tbz"          =>      "application/x-bzip-compressed-tar",
  ".tar.bz2"      =>      "application/x-bzip-compressed-tar"

 


延伸阅读:
告诉你如何关闭GZIP,多种程序方法
文件压缩成Gzip格式的类
使用mod_gzip加速你的html页面
PHP使用zlib扩展实现页面GZIP压缩输出
php对gzip文件或者字符串解压实例参考
使用PHP和GZip压缩网站JS/CSS文件加速网站访问速度
php启用gzip页面压缩示例
Linux空间用Gzip对网页内容进行压缩
什么是GZIP
IIS或Apache启用GZIP压缩优化网站
apache性能优化之启用gzip压缩
lighttpd开启gzip压缩
Tags: lighttpd   服务端   gzip   压缩  
PHP程序员站 Copyright © 2007-2010,PHPERZ.COM All Rights Reserved 粤ICP备07503606号