切换到宽版
  • 2800Read
  • 1Replay

lighttpd 分享目录 [复制链接]

上一主题 下一主题
离线Francis
 

只看楼主 倒序阅读 使用道具 楼主  posttime: 2016-01-12
— 本帖被 admin 执行置顶操作(2016-02-01) —
1. Vim  lighttpd_dir.sh, 粘贴后面的内容
2. Chmod a+x lighttpd_dir.sh 添加可执行权限
3. ./lighttpd_dir /home 8080,通过8080端口分享/home目录


  1. #!/bin/bash
  2. cat >._lighttpd_dir_conf << EOF
  3. server.document-root = "$1"
  4. server.port = "$2"
  5. dir-listing.encoding        = "utf-8"
  6. server.dir-listing          = "enable"
  7. mimetype.assign = (
  8.   ".pdf"          =>      "application/pdf",
  9.   ".zip"          =>      "application/zip",
  10.   ".mp3"          =>      "audio/mpeg",
  11.   ".jpg"          =>      "image/jpeg",
  12.   ".html"         =>      "text/html",
  13.   ".c"            =>      "text/plain",
  14.   ".txt"          =>      "text/plain",
  15.   ".avi"          =>      "video/x-msvideo",
  16. )
  17. EOF
  18. lighttpd -D -f ._lighttpd_dir_conf






离线Francis

只看该作者 沙发  posttime: 2016-01-12
mimetype.assign = (
  ".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"
)
快速回复
限100 字节
如果您在写长篇帖子又不马上发表,建议存为草稿
 
上一个 下一个