Advertisement
ciusss89

Openwrt lighttpd.conf

Oct 17th, 2011
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 7.87 KB | None | 0 0
  1. # lighttpd configuration file
  2. #
  3. ## modules to load
  4. # all other module should only be loaded if really neccesary
  5. # - saves some time
  6. # - saves memory
  7. server.modules = (
  8. #   "mod_rewrite",
  9. #   "mod_redirect",
  10. #   "mod_alias",
  11. #   "mod_auth",
  12. #   "mod_status",
  13. #   "mod_setenv",
  14. #   "mod_fastcgi",
  15. #   "mod_proxy",
  16. #   "mod_simple_vhost",
  17.     "mod_cgi",
  18. #   "mod_ssi",
  19. #   "mod_usertrack",
  20. #   "mod_expire",
  21. #   "mod_webdav"
  22. )
  23.  
  24. # force use of the "write" backend (closes: #2401)
  25. server.network-backend = "write"
  26.  
  27. ## a static document-root, for virtual-hosting take look at the
  28. ## server.virtual-* options
  29. server.document-root = "/home/04_WWW/"
  30.  
  31. ## where to send error-messages to
  32. server.errorlog = "/var/log/lighttpd/error.log"
  33.  
  34. ## files to check for if .../ is requested
  35. index-file.names = ( "index.html", "default.html", "index.htm", "default.htm", "index.php" )
  36.  
  37. ## Event Handler
  38. server.event-handler = "poll"
  39.  
  40. ## mimetype mapping
  41. mimetype.assign = (  
  42. ".pdf"          =>      "application/pdf",
  43.   ".sig"          =>      "application/pgp-signature",
  44.   ".spl"          =>      "application/futuresplash",
  45.   ".class"        =>      "application/octet-stream",
  46.   ".ps"           =>      "application/postscript",
  47.   ".torrent"      =>      "application/x-bittorrent",
  48.   ".dvi"          =>      "application/x-dvi",
  49.   ".gz"           =>      "application/x-gzip",
  50.   ".pac"          =>      "application/x-ns-proxy-autoconfig",
  51.   ".swf"          =>      "application/x-shockwave-flash",
  52.   ".tar.gz"       =>      "application/x-tgz",
  53.   ".tgz"          =>      "application/x-tgz",
  54.   ".tar"          =>      "application/x-tar",
  55.   ".zip"          =>      "application/zip",
  56.   ".mp3"          =>      "audio/mpeg",
  57.   ".m3u"          =>      "audio/x-mpegurl",
  58.   ".wma"          =>      "audio/x-ms-wma",
  59.   ".wax"          =>      "audio/x-ms-wax",
  60.   ".ogg"          =>      "application/ogg",
  61.   ".wav"          =>      "audio/x-wav",
  62.   ".gif"          =>      "image/gif",
  63.   ".jpg"          =>      "image/jpeg",
  64.   ".jpeg"         =>      "image/jpeg",
  65.   ".png"          =>      "image/png",
  66.   ".xbm"          =>      "image/x-xbitmap",
  67.   ".xpm"          =>      "image/x-xpixmap",
  68.   ".xwd"          =>      "image/x-xwindowdump",
  69.   ".css"          =>      "text/css",
  70.   ".html"         =>      "text/html",
  71.   ".htm"          =>      "text/html",
  72.   ".js"           =>      "text/javascript",
  73.   ".asc"          =>      "text/plain",
  74.   ".c"            =>      "text/plain",
  75.   ".cpp"          =>      "text/plain",
  76.   ".log"          =>      "text/plain",
  77.   ".conf"         =>      "text/plain",
  78.   ".text"         =>      "text/plain",
  79.   ".txt"          =>      "text/plain",
  80.   ".dtd"          =>      "text/xml",
  81.   ".xml"          =>      "text/xml",
  82.   ".mpeg"         =>      "video/mpeg",
  83.   ".mpg"          =>      "video/mpeg",
  84.   ".mov"          =>      "video/quicktime",
  85.   ".qt"           =>      "video/quicktime",
  86.   ".avi"          =>      "video/x-msvideo",
  87.   ".asf"          =>      "video/x-ms-asf",
  88.   ".asx"          =>      "video/x-ms-asf",
  89.   ".wmv"          =>      "video/x-ms-wmv",
  90.   ".bz2"          =>      "application/x-bzip",
  91.   ".tbz"          =>      "application/x-bzip-compressed-tar",
  92.   ".tar.bz2"      =>      "application/x-bzip-compressed-tar"
  93.  )
  94.  
  95. ## Use the "Content-Type" extended attribute to obtain mime type if possible
  96. #mimetypes.use-xattr = "enable"
  97.  
  98. ## send a different Server: header
  99. ## be nice and keep it at lighttpd
  100. #server.tag = "lighttpd"
  101.  
  102. $HTTP["url"] =~ "\.pdf$" {
  103.     server.range-requests = "disable"
  104. }
  105.  
  106. ##
  107. # which extensions should not be handle via static-file transfer
  108. #
  109. # .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
  110. static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
  111.  
  112. ######### Options that are good to be but not neccesary to be changed #######
  113.  
  114. ## bind to port (default: 80)
  115. server.port = 81
  116.  
  117. ## bind to localhost (default: all interfaces)
  118. #server.bind = "localhost"
  119.  
  120. ## error-handler for status 404
  121. #server.error-handler-404 = "/error-handler.html"
  122. #server.error-handler-404 = "/error-handler.php"
  123.  
  124. ## to help the rc.scripts
  125. server.pid-file = "/var/run/lighttpd.pid"
  126.  
  127.  
  128. ###### virtual hosts
  129. ##
  130. ##   If you want name-based virtual hosting add the next three settings and load
  131. ##   mod_simple_vhost
  132. ##
  133. ## document-root =
  134. ##   virtual-server-root + virtual-server-default-host + virtual-server-docroot or
  135. ##   virtual-server-root + http-host + virtual-server-docroot
  136. ##
  137. #simple-vhost.server-root = "/home/weigon/wwwroot/servers/"
  138. #simple-vhost.default-host = "grisu.home.kneschke.de"
  139. #simple-vhost.document-root = "/pages/"
  140.  
  141.  
  142. ##
  143. ## Format: <errorfile-prefix><status>.html
  144. ## -> ..../status-404.html for 'File not found'
  145. #server.errorfile-prefix = "/www/error-"
  146.  
  147. ## virtual directory listings
  148. #server.dir-listing = "enable"
  149.  
  150. ## send unhandled HTTP-header headers to error-log
  151. #debug.dump-unknown-headers = "enable"
  152.  
  153. ### only root can use these options
  154. #
  155. # chroot() to directory (default: no chroot() )
  156. #server.chroot = "/"
  157.  
  158. ## change uid to <uid> (default: don't care)
  159. #server.username = "nobody"
  160. #
  161. server.upload-dirs = ( "/tmp" )
  162.  
  163. ## change uid to <uid> (default: don't care)
  164. #server.groupname = "nobody"
  165.  
  166. #### compress module
  167. #compress.cache-dir          = "/dev/null/"
  168. #compress.filetype           = ("text/plain", "text/html")
  169.  
  170. #### proxy module
  171. ## read proxy.txt for more info
  172. #proxy.server = (
  173. #   ".php" => (
  174. #       "localhost" => (
  175. #           "host" => "192.168.0.101",
  176. #           "port" => 80
  177. #       )
  178. #   )
  179. #)
  180.  
  181. #### fastcgi module
  182. ## read fastcgi.txt for more info
  183. #fastcgi.server = (
  184. #   ".php" => (
  185. #       "localhost" => (
  186. #           "socket" => "/tmp/php-fastcgi.socket",
  187. #           "bin-path" => "/usr/local/bin/php"
  188. #       )
  189. #   )
  190. #)
  191.  
  192. #### CGI module
  193. cgi.assign = ( ".php"  => "/usr/bin/php-cgi" )
  194.  
  195. #### SSL engine
  196. #ssl.engine = "enable"
  197. #ssl.pemfile = "server.pem"
  198.  
  199. #### status module
  200. #status.status-url = "/server-status"
  201. #status.config-url = "/server-config"
  202.  
  203. #### auth module
  204. ## read authentification.txt for more info
  205. #auth.backend = "plain"
  206. #auth.backend.plain.userfile = "lighttpd.user"
  207. #auth.backend.plain.groupfile = "lighttpd.group"
  208. #auth.require = (
  209. #   "/server-status" => (
  210. #       "method"  => "digest",
  211. #       "realm"   => "download archiv",
  212. #       "require" => "group=www|user=jan|host=192.168.2.10"
  213. #   ),
  214. #   "/server-info" => (
  215. #       "method"  => "digest",
  216. #       "realm"   => "download archiv",
  217. #       "require" => "group=www|user=jan|host=192.168.2.10"
  218. #   )
  219. #)
  220.  
  221. #### url handling modules (rewrite, redirect, access)
  222. #url.rewrite = ( "^/$" => "/server-status" )
  223. #url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )
  224.  
  225. #### both rewrite/redirect support back reference to regex conditional using %n
  226. #$HTTP["host"] =~ "^www\.(.*)" {
  227. #   url.redirect = ( "^/(.*)" => "http://%1/$1" )
  228. #}
  229.  
  230. #### expire module
  231. #expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")
  232.  
  233. #### ssi
  234. #ssi.extension = ( ".shtml" )
  235.  
  236. #### setenv
  237. #setenv.add-request-header  = ( "TRAV_ENV" => "mysql://user@host/db" )
  238. #setenv.add-response-header = ( "X-Secret-Message" => "42" )
  239.  
  240. #### variable usage:
  241. ## variable name without "." is auto prefixed by "var." and becomes "var.bar"
  242. #bar = 1
  243. #var.mystring = "foo"
  244.  
  245. ## integer add
  246. #bar += 1
  247. ## string concat, with integer cast as string, result: "www.foo1.com"
  248. #server.name = "www." + mystring + var.bar + ".com"
  249. ## array merge
  250. #index-file.names = (foo + ".php") + index-file.names
  251. #index-file.names += (foo + ".php")
  252.  
  253. #### include
  254. #include /etc/lighttpd/lighttpd-inc.conf
  255. ## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
  256. #include "lighttpd-inc.conf"
  257.  
  258. #### include_shell
  259. #include_shell "echo var.a=1"
  260. ## the above is same as:
  261. #var.a=1
  262.  
  263. #### webdav
  264. #$HTTP["url"] =~ "^/webdav($|/)" {
  265. # webdav.activate = "enable"
  266. # webdav.is-readonly = "enable"
  267. # webdav.sqlite-db-name = "/var/run/lighttpd-webdav-lock.db"
  268. #}
  269.  
  270.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement