Advertisement
Guest User

lighttpd.conf

a guest
Jul 17th, 2013
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.08 KB | None | 0 0
  1. # lighttpd configuration file
  2.  
  3. ############ Options you really have to take care of ####################
  4.  
  5. ## modules to load
  6. # at least mod_access and mod_accesslog should be loaded
  7. # all other module should only be loaded if really neccesary
  8. # - saves some time
  9. # - saves memory
  10. server.modules = (
  11. # "mod_rewrite",
  12. # "mod_redirect",
  13. # "mod_alias",
  14. "mod_access",
  15. # "mod_trigger_b4_dl",
  16. # "mod_auth",
  17. # "mod_status",
  18. # "mod_setenv",
  19. "mod_fastcgi",
  20. # "mod_proxy",
  21. # "mod_simple_vhost",
  22. # "mod_evhost",
  23. # "mod_userdir",
  24. "mod_cgi",
  25. # "mod_compress",
  26. # "mod_ssi",
  27. # "mod_usertrack",
  28. # "mod_expire",
  29. # "mod_secdownload",
  30. # "mod_rrdtool",
  31. "mod_accesslog" )
  32.  
  33. ## A static document-root. For virtual hosting take a look at the
  34. ## mod_simple_vhost module.
  35. server.document-root = "htdocs/"
  36.  
  37. #### accesslog module
  38. accesslog.filename = "logs/access.log"
  39.  
  40. ## where to send error-messages to
  41. server.errorlog = "logs/error.log"
  42.  
  43. # files to check for if .../ is requested
  44. index-file.names = ( "index.php", "index.html", "index.htm", "default.htm" )
  45.  
  46. server.event-handler = "kqueue"
  47. server.network-backend = "writev"
  48.  
  49. server.bind = "0.0.0.0"
  50. server.port = "80"
  51.  
  52. $SERVER["socket"] == "[::]:80" { }
  53.  
  54. # mimetype mapping
  55. mimetype.assign = (
  56. ".pdf" => "application/pdf",
  57. ".sig" => "application/pgp-signature",
  58. ".spl" => "application/futuresplash",
  59. ".class" => "application/octet-stream",
  60. ".ps" => "application/postscript",
  61. ".torrent" => "application/x-bittorrent",
  62. ".dvi" => "application/x-dvi",
  63. ".gz" => "application/x-gzip",
  64. ".pac" => "application/x-ns-proxy-autoconfig",
  65. ".swf" => "application/x-shockwave-flash",
  66. ".tar.gz" => "application/x-tgz",
  67. ".tgz" => "application/x-tgz",
  68. ".tar" => "application/x-tar",
  69. ".zip" => "application/zip",
  70. ".mp3" => "audio/mpeg",
  71. ".m3u" => "audio/x-mpegurl",
  72. ".wma" => "audio/x-ms-wma",
  73. ".wax" => "audio/x-ms-wax",
  74. ".ogg" => "application/ogg",
  75. ".wav" => "audio/x-wav",
  76. ".gif" => "image/gif",
  77. ".jar" => "application/x-java-archive",
  78. ".jpg" => "image/jpeg",
  79. ".jpeg" => "image/jpeg",
  80. ".png" => "image/png",
  81. ".xbm" => "image/x-xbitmap",
  82. ".xpm" => "image/x-xpixmap",
  83. ".xwd" => "image/x-xwindowdump",
  84. ".css" => "text/css",
  85. ".html" => "text/html",
  86. ".htm" => "text/html",
  87. ".js" => "text/javascript",
  88. ".asc" => "text/plain",
  89. ".c" => "text/plain",
  90. ".cpp" => "text/plain",
  91. ".log" => "text/plain",
  92. ".conf" => "text/plain",
  93. ".text" => "text/plain",
  94. ".txt" => "text/plain",
  95. ".dtd" => "text/xml",
  96. ".xml" => "text/xml",
  97. ".mpeg" => "video/mpeg",
  98. ".mpg" => "video/mpeg",
  99. ".mov" => "video/quicktime",
  100. ".qt" => "video/quicktime",
  101. ".avi" => "video/x-msvideo",
  102. ".asf" => "video/x-ms-asf",
  103. ".asx" => "video/x-ms-asf",
  104. ".wmv" => "video/x-ms-wmv",
  105. ".bz2" => "application/x-bzip",
  106. ".tbz" => "application/x-bzip-compressed-tar",
  107. ".tar.bz2" => "application/x-bzip-compressed-tar",
  108. # default mime type
  109. "" => "application/octet-stream",
  110. )
  111.  
  112. # Use the "Content-Type" extended attribute to obtain mime type if possible
  113. #mimetype.use-xattr = "enable"
  114.  
  115. ## send a different Server: header
  116. ## be nice and keep it at lighttpd
  117. # server.tag = "lighttpd"
  118.  
  119. ## deny access the file-extensions
  120. #
  121. # ~ is for backupfiles from vi, emacs, joe, ...
  122. # .inc is often used for code includes which should in general not be part
  123. # of the document-root
  124. url.access-deny = ( "~", ".inc" )
  125.  
  126. $HTTP["url"] =~ "\.pdf$" {
  127. server.range-requests = "disable"
  128. }
  129.  
  130. ##
  131. # which extensions should not be handle via static-file transfer
  132. #
  133. # .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
  134. static-file.exclude-extensions = ( ".html", ".php", ".pl", ".fcgi" )
  135.  
  136. ######### Options that are good to be but not neccesary to be changed #######
  137.  
  138. ## error-handler for status 404
  139. #server.error-handler-404 = "/error-handler.html"
  140. #server.error-handler-404 = "/error-handler.php"
  141.  
  142. ## to help the rc.scripts
  143. server.pid-file = "/var/run/lighttpd.pid"
  144.  
  145. ###### virtual hosts
  146. ##
  147. ## If you want name-based virtual hosting add the next three settings and load
  148. ## mod_simple_vhost
  149. ##
  150. ## document-root =
  151. ## virtual-server-root + virtual-server-default-host + virtual-server-docroot
  152. ## or
  153. ## virtual-server-root + http-host + virtual-server-docroot
  154. ##
  155. #simple-vhost.server-root = "/srv/www/vhosts/"
  156. #simple-vhost.default-host = "www.example.org"
  157. #simple-vhost.document-root = "/htdocs/"
  158.  
  159.  
  160. ##
  161. ## Format: <errorfile-prefix><status-code>.html
  162. ## -> ..../status-404.html for 'File not found'
  163. #server.errorfile-prefix = "/usr/share/lighttpd/errors/status-"
  164. #server.errorfile-prefix = "/srv/www/errors/status-"
  165.  
  166. ## virtual directory listings
  167. #dir-listing.activate = "enable"
  168. ## select encoding for directory listings
  169. #dir-listing.encoding = "utf-8"
  170.  
  171. ## enable debugging
  172. #debug.log-request-header = "enable"
  173. #debug.log-response-header = "enable"
  174. #debug.log-request-handling = "enable"
  175. #debug.log-file-not-found = "enable"
  176.  
  177. # chroot() to directory
  178. server.chroot = "/var/www/"
  179.  
  180. server.username = "_lighttpd"
  181. server.groupname = "_lighttpd"
  182.  
  183. #### compress module
  184. #compress.cache-dir = "/var/cache/lighttpd/compress/"
  185. #compress.filetype = ("text/plain", "text/html")
  186.  
  187. #### proxy module
  188. ## read proxy.txt for more info
  189. #proxy.server = ( ".php" =>
  190. # ( "localhost" =>
  191. # (
  192. # "host" => "192.168.0.101",
  193. # "port" => 80
  194. # )
  195. # )
  196. # )
  197.  
  198. #### fastcgi module
  199. ## read fastcgi.txt for more info
  200. ## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
  201. fastcgi.server = ( ".php" =>
  202. ( "localhost" =>
  203. (
  204. "host" => "127.0.0.1",
  205. "port" => "9123"
  206. )
  207. )
  208. )
  209.  
  210. #### CGI module
  211. #cgi.assign = ( ".pl" => "/usr/bin/perl",
  212. # ".cgi" => "/usr/bin/perl" )
  213. #
  214.  
  215. #### SSL engine
  216. #ssl.engine = "enable"
  217. #ssl.pemfile = "/etc/ssl/private/lighttpd.pem"
  218.  
  219. #### status module
  220. #status.status-url = "/server-status"
  221. #status.config-url = "/server-config"
  222.  
  223. #### auth module
  224. ## read authentication.txt for more info
  225. #auth.backend = "plain"
  226. #auth.backend.plain.userfile = "lighttpd.user"
  227. #auth.backend.plain.groupfile = "lighttpd.group"
  228.  
  229. #auth.backend.ldap.hostname = "localhost"
  230. #auth.backend.ldap.base-dn = "dc=my-domain,dc=com"
  231. #auth.backend.ldap.filter = "(uid=$)"
  232.  
  233. #auth.require = ( "/server-status" =>
  234. # (
  235. # "method" => "digest",
  236. # "realm" => "download archiv",
  237. # "require" => "user=jan"
  238. # ),
  239. # "/server-config" =>
  240. # (
  241. # "method" => "digest",
  242. # "realm" => "download archiv",
  243. # "require" => "valid-user"
  244. # )
  245. # )
  246.  
  247. #### url handling modules (rewrite, redirect, access)
  248. #url.rewrite = ( "^/$" => "/server-status" )
  249. #url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )
  250. #### both rewrite/redirect support back reference to regex conditional using %n
  251. #$HTTP["host"] =~ "^www\.(.*)" {
  252. # url.redirect = ( "^/(.*)" => "http://%1/$1" )
  253. #}
  254.  
  255. #
  256. # define a pattern for the host url finding
  257. # %% => % sign
  258. # %0 => domain name + tld
  259. # %1 => tld
  260. # %2 => domain name without tld
  261. # %3 => subdomain 1 name
  262. # %4 => subdomain 2 name
  263. #
  264. #evhost.path-pattern = "/srv/www/vhosts/%3/htdocs/"
  265.  
  266. #### expire module
  267. #expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")
  268.  
  269. #### ssi
  270. #ssi.extension = ( ".shtml" )
  271.  
  272. #### rrdtool
  273. #rrdtool.binary = "/usr/local/bin/rrdtool"
  274. #rrdtool.db-name = "/var/lib/lighttpd/lighttpd.rrd"
  275.  
  276. #### setenv
  277. #setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" )
  278. #setenv.add-response-header = ( "X-Secret-Message" => "42" )
  279.  
  280. ## for mod_trigger_b4_dl
  281. # trigger-before-download.gdbm-filename = "/var/lib/lighttpd/trigger.db"
  282. # trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
  283. # trigger-before-download.trigger-url = "^/trigger/"
  284. # trigger-before-download.download-url = "^/download/"
  285. # trigger-before-download.deny-url = "http://127.0.0.1/index.html"
  286. # trigger-before-download.trigger-timeout = 10
  287.  
  288. #### variable usage:
  289. ## variable name without "." is auto prefixed by "var." and becomes "var.bar"
  290. #bar = 1
  291. #var.mystring = "foo"
  292.  
  293. ## integer add
  294. #bar += 1
  295. ## string concat, with integer cast as string, result: "www.foo1.com"
  296. #server.name = "www." + mystring + var.bar + ".com"
  297. ## array merge
  298. #index-file.names = (foo + ".php") + index-file.names
  299. #index-file.names += (foo + ".php")
  300.  
  301. #### include
  302. #include /etc/lighttpd/lighttpd-inc.conf
  303. ## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
  304. #include "lighttpd-inc.conf"
  305.  
  306. #### include_shell
  307. #include_shell "echo var.a=1"
  308. ## the above is same as:
  309. #var.a=1
  310.  
  311.  
  312. fastcgi.map-extensions = ( ".html" => ".php",
  313. ".php3" => ".php" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement