lighttpd.conf 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. #######################################################################
  2. ##
  3. ## /etc/lighttpd/lighttpd.conf
  4. ##
  5. ## check /etc/lighttpd/conf.d/*.conf for the configuration of modules.
  6. ##
  7. #######################################################################
  8. #######################################################################
  9. ##
  10. ## Some Variable definition which will make chrooting easier.
  11. ##
  12. ## if you add a variable here. Add the corresponding variable in the
  13. ## chroot example as well.
  14. ##
  15. var.log_root = "/var/log/lighttpd"
  16. var.server_root = "/srv/www"
  17. var.state_dir = "/run"
  18. var.home_dir = "/var/lib/lighttpd"
  19. var.conf_dir = "/etc/lighttpd"
  20. ##
  21. ## run the server chrooted.
  22. ##
  23. ## This requires root permissions during startup.
  24. ##
  25. ## If you run Chrooted set the the variables to directories relative to
  26. ## the chroot dir.
  27. ##
  28. ## example chroot configuration:
  29. ##
  30. #var.log_root = "/logs"
  31. #var.server_root = "/"
  32. #var.state_dir = "/run"
  33. #var.home_dir = "/lib/lighttpd"
  34. #var.vhosts_dir = "/vhosts"
  35. #var.conf_dir = "/etc"
  36. #
  37. #server.chroot = "/srv/www"
  38. ##
  39. ## Some additional variables to make the configuration easier
  40. ##
  41. ##
  42. ## Base directory for all virtual hosts
  43. ##
  44. ## used in:
  45. ## conf.d/evhost.conf
  46. ## conf.d/simple_vhost.conf
  47. ## vhosts.d/vhosts.template
  48. ##
  49. var.vhosts_dir = server_root + "/vhosts"
  50. ##
  51. ## Cache for mod_deflate
  52. ##
  53. ## used in:
  54. ## conf.d/deflate.conf
  55. ##
  56. var.cache_dir = "/var/cache/lighttpd"
  57. ##
  58. ## Base directory for sockets.
  59. ##
  60. ## used in:
  61. ## conf.d/fastcgi.conf
  62. ## conf.d/scgi.conf
  63. ##
  64. var.socket_dir = home_dir + "/sockets"
  65. ##
  66. #######################################################################
  67. #######################################################################
  68. ##
  69. ## Load the modules.
  70. include conf_dir + "/modules.conf"
  71. ##
  72. #######################################################################
  73. #######################################################################
  74. ##
  75. ## Basic Configuration
  76. ## ---------------------
  77. ##
  78. server.port = 80
  79. ##
  80. ## Use IPv6?
  81. ##
  82. server.use-ipv6 = "enable"
  83. ##
  84. ## bind to a specific IP
  85. ##
  86. #server.bind = "localhost"
  87. ##
  88. ## Run as a different username/groupname.
  89. ## This requires root permissions during startup.
  90. ##
  91. server.username = "lighttpd"
  92. server.groupname = "lighttpd"
  93. ##
  94. ## Enable lighttpd to serve requests on sockets received from systemd
  95. ## https://www.freedesktop.org/software/systemd/man/systemd.socket.html
  96. ##
  97. #server.systemd-socket-activation = "enable"
  98. ##
  99. ## enable core files.
  100. ##
  101. #server.core-files = "disable"
  102. ##
  103. ## Document root
  104. ##
  105. server.document-root = server_root + "/htdocs"
  106. ##
  107. ## The value for the "Server:" response field.
  108. ##
  109. ## It would be nice to keep it at "lighttpd".
  110. ##
  111. #server.tag = "lighttpd"
  112. ##
  113. ## store a pid file
  114. ##
  115. server.pid-file = state_dir + "/lighttpd.pid"
  116. ##
  117. #######################################################################
  118. #######################################################################
  119. ##
  120. ## Logging Options
  121. ## ------------------
  122. ##
  123. ## all logging options can be overwritten per vhost.
  124. ##
  125. ## Path to the error log file
  126. ##
  127. server.errorlog = log_root + "/error.log"
  128. ##
  129. ## If you want to log to syslog you have to unset the
  130. ## server.errorlog setting and uncomment the next line.
  131. ##
  132. #server.errorlog-use-syslog = "enable"
  133. ##
  134. ## Access log config
  135. ##
  136. include conf_dir + "/conf.d/access_log.conf"
  137. ##
  138. ## The debug options are moved into their own file.
  139. ## see conf.d/debug.conf for various options for request debugging.
  140. ##
  141. include conf_dir + "/conf.d/debug.conf"
  142. ##
  143. #######################################################################
  144. #######################################################################
  145. ##
  146. ## Tuning/Performance
  147. ## --------------------
  148. ##
  149. ## corresponding documentation:
  150. ## https://wiki.lighttpd.net/Docs_Performance
  151. ##
  152. ## set the event-handler (read the performance section in the manual)
  153. ##
  154. ## The recommended server.event-handler is chosen by default for each OS.
  155. ##
  156. ## epoll (recommended on Linux)
  157. ## kqueue (recommended on *BSD and MacOS X)
  158. ## solaris-eventports (recommended on Solaris)
  159. ## poll (recommended if none of above are available)
  160. ## select (*not* recommended)
  161. ## libev (*not* recommended)
  162. ##
  163. #server.event-handler = "linux-sysepoll"
  164. ##
  165. ## The basic network interface for all platforms at the syscalls read()
  166. ## and write(). Every modern OS provides its own syscall to help network
  167. ## servers transfer files as fast as possible
  168. ##
  169. #server.network-backend = "sendfile"
  170. ##
  171. ## As lighttpd is a single-threaded server, its main resource limit is
  172. ## the number of file descriptors, which is set to 1024 by default (on
  173. ## most systems).
  174. ##
  175. ## If you are running a high-traffic site you might want to increase this
  176. ## limit by setting server.max-fds.
  177. ##
  178. ## Changing this setting requires root permissions on startup. see
  179. ## server.username/server.groupname.
  180. ##
  181. ## By default lighttpd would not change the operation system default.
  182. ## But setting it to 16384 is a better default for busy servers.
  183. ##
  184. ## With SELinux enabled, this is denied by default and needs to be allowed
  185. ## by running the following once: setsebool -P httpd_setrlimit on
  186. ##
  187. server.max-fds = 16384
  188. ##
  189. ## listen-backlog is the size of the listen() backlog queue requested when
  190. ## the lighttpd server ask the kernel to listen() on the provided network
  191. ## address. Clients attempting to connect() to the server enter the listen()
  192. ## backlog queue and wait for the lighttpd server to accept() the connection.
  193. ##
  194. ## The out-of-box default on many operating systems is 128 and is identified
  195. ## as SOMAXCONN. This can be tuned on many operating systems. (On Linux,
  196. ## cat /proc/sys/net/core/somaxconn) Requesting a size larger than operating
  197. ## system limit will be silently reduced to the limit by the operating system.
  198. ##
  199. ## When there are too many connection attempts waiting for the server to
  200. ## accept() new connections, the listen backlog queue fills and the kernel
  201. ## rejects additional connection attempts. This can be useful as an
  202. ## indication to an upstream load balancer that the server is busy, and
  203. ## possibly overloaded. In that case, configure a smaller limit for
  204. ## server.listen-backlog. On the other hand, configure a larger limit to be
  205. ## able to handle bursts of new connections, but only do so up to an amount
  206. ## that the server can keep up with responding in a reasonable amount of
  207. ## time. Otherwise, clients may abandon the connection attempts and the
  208. ## server will waste resources servicing abandoned connections.
  209. ##
  210. ## It is best to leave this setting at its default unless you have modelled
  211. ## your traffic and tested that changing this benefits your traffic patterns.
  212. ##
  213. ## Default: 1024
  214. ##
  215. #server.listen-backlog = 128
  216. ##
  217. ## Stat() call caching.
  218. ##
  219. ## lighttpd can utilize FAM/Gamin to cache stat call.
  220. ##
  221. ## possible values are:
  222. ## disable, simple, inotify, kqueue, or fam.
  223. ##
  224. #server.stat-cache-engine = "simple"
  225. ##
  226. ## Fine tuning for the request handling
  227. ##
  228. ## max-connections == max-fds/3)
  229. ## (other file handles are used for fastcgi/files)
  230. ##
  231. #server.max-connections = 1024
  232. ##
  233. ## How many seconds to keep a keep-alive connection open,
  234. ## until we consider it idle.
  235. ##
  236. ## Default: 5
  237. ##
  238. #server.max-keep-alive-idle = 5
  239. ##
  240. ## How many keep-alive requests until closing the connection.
  241. ##
  242. ## Default: 16
  243. ##
  244. #server.max-keep-alive-requests = 16
  245. ##
  246. ## Maximum size of a request in kilobytes.
  247. ## By default it is unlimited (0).
  248. ##
  249. ## Uploads to your server cant be larger than this value.
  250. ##
  251. #server.max-request-size = 0
  252. ##
  253. ## Time to read from a socket before we consider it idle.
  254. ##
  255. ## Default: 60
  256. ##
  257. #server.max-read-idle = 60
  258. ##
  259. ## Time to write to a socket before we consider it idle.
  260. ##
  261. ## Default: 360
  262. ##
  263. #server.max-write-idle = 360
  264. ##
  265. ## Traffic Shaping
  266. ## -----------------
  267. ##
  268. ## see /usr/share/doc/lighttpd/traffic-shaping.txt
  269. ##
  270. ## Values are in kilobyte per second.
  271. ##
  272. ## Keep in mind that a limit below 32kB/s might actually limit the
  273. ## traffic to 32kB/s. This is caused by the size of the TCP send
  274. ## buffer.
  275. ##
  276. ## per server:
  277. ##
  278. #server.kbytes-per-second = 128
  279. ##
  280. ## per connection:
  281. ##
  282. #connection.kbytes-per-second = 32
  283. ##
  284. #######################################################################
  285. #######################################################################
  286. ##
  287. ## Filename/File handling
  288. ## ------------------------
  289. ##
  290. ## files to check for if .../ is requested
  291. ## index-file.names = ( "index.php", "index.rb", "index.html",
  292. ## "index.htm", "default.htm" )
  293. ##
  294. index-file.names += (
  295. "index.xhtml", "index.html", "index.htm", "default.htm", "index.php"
  296. )
  297. ##
  298. ## deny access the file-extensions
  299. ##
  300. ## ~ is for backupfiles from vi, emacs, joe, ...
  301. ## .inc is often used for code includes which should in general not be part
  302. ## of the document-root
  303. url.access-deny = ( "~", ".inc" )
  304. ##
  305. ## disable range requests for pdf files
  306. ## workaround for a bug in the Acrobat Reader plugin.
  307. ## (ancient; should no longer be needed)
  308. ##
  309. #$HTTP["url"] =~ "\.pdf$" {
  310. # server.range-requests = "disable"
  311. #}
  312. ##
  313. ## url handling modules (rewrite, redirect)
  314. ##
  315. #url.rewrite = ( "^/$" => "/server-status" )
  316. #url.redirect = ( "^/wishlist/(.+)" => "http://www.example.com/$1" )
  317. ##
  318. ## both rewrite/redirect support back reference to regex conditional using %n
  319. ##
  320. #$HTTP["host"] =~ "^www\.(.*)" {
  321. # url.redirect = ( "^/(.*)" => "http://%1/$1" )
  322. #}
  323. ##
  324. ## which extensions should not be handle via static-file transfer
  325. ##
  326. ## .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
  327. ##
  328. static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )
  329. ##
  330. ## error-handler for all status 400-599
  331. ##
  332. #server.error-handler = "/error-handler.html"
  333. #server.error-handler = "/error-handler.php"
  334. ##
  335. ## error-handler for status 404
  336. ##
  337. #server.error-handler-404 = "/error-handler.html"
  338. #server.error-handler-404 = "/error-handler.php"
  339. ##
  340. ## Format: <errorfile-prefix><status-code>.html
  341. ## -> ..../status-404.html for 'File not found'
  342. ##
  343. #server.errorfile-prefix = "/srv/www/htdocs/errors/status-"
  344. ##
  345. ## mimetype mapping
  346. ##
  347. include conf_dir + "/conf.d/mime.conf"
  348. ##
  349. ## directory listing configuration
  350. ##
  351. include conf_dir + "/conf.d/dirlisting.conf"
  352. ##
  353. ## Should lighttpd follow symlinks?
  354. ## default: "enable"
  355. #server.follow-symlink = "enable"
  356. ##
  357. ## force all filenames to be lowercase?
  358. ##
  359. #server.force-lowercase-filenames = "disable"
  360. ##
  361. ## defaults to /var/tmp as we assume it is a local harddisk
  362. ## default: "/var/tmp"
  363. #server.upload-dirs = ( "/var/tmp" )
  364. ##
  365. #######################################################################
  366. #######################################################################
  367. ##
  368. ## SSL Support
  369. ## -------------
  370. ##
  371. ## https://wiki.lighttpd.net/Docs_SSL
  372. #
  373. ## To enable SSL for the whole server you have to provide a valid
  374. ## certificate and have to enable the SSL engine.::
  375. ##
  376. ## server.modules += ( "mod_openssl" )
  377. ##
  378. ## ssl.privkey = "/path/to/privkey.pem"
  379. ## ssl.pemfile = "/path/to/fullchain.pem"
  380. ## # ssl.pemfile should contain the sorted certificate chain, including
  381. ## # intermediate certificates, as provided by the certificate issuer.
  382. ## # If both privkey and cert are in same file, specify only ssl.pemfile.
  383. ##
  384. ## # Check your cipher list with: openssl ciphers -v '...'
  385. ## # (use single quotes with: openssl ciphers -v '...'
  386. ## # as your shell won't like ! in double quotes)
  387. ## #ssl.cipher-list = "HIGH" # default
  388. ##
  389. ## # (recommended to accept only TLSv1.2 and TLSv1.3)
  390. ## #ssl.openssl.ssl-conf-cmd = ("MinProtocol" => "TLSv1.2") # default
  391. ##
  392. ## $SERVER["socket"] == "*:443" {
  393. ## ssl.engine = "enable"
  394. ## }
  395. ## $SERVER["socket"] == "[::]:443" {
  396. ## ssl.engine = "enable"
  397. ## }
  398. ##
  399. #######################################################################
  400. #######################################################################
  401. ##
  402. ## custom includes like vhosts.
  403. ##
  404. #include conf_dir + "/conf.d/config.conf"
  405. #include conf_dir + "/vhosts.d/*.conf"
  406. ##
  407. #######################################################################