lighttpd.conf 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. debug.log-request-handling = "enable"
  2. debug.log-request-header = "enable"
  3. debug.log-response-header = "enable"
  4. #debug.log-condition-handling = "enable"
  5. ## 64 Mbyte ... nice limit
  6. server.max-request-size = 65000
  7. server.systemd-socket-activation = "enable"
  8. # optional bind spec override, e.g. for platforms without socket activation
  9. include env.SRCDIR + "/tmp/bind*.conf"
  10. server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
  11. server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
  12. server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
  13. server.name = "www.example.org"
  14. server.tag = "lighttpd-1.4.x"
  15. server.dir-listing = "enable"
  16. server.modules = (
  17. "mod_extforward",
  18. "mod_auth",
  19. "mod_authn_file",
  20. "mod_setenv",
  21. "mod_access",
  22. "mod_expire",
  23. "mod_simple_vhost",
  24. "mod_cgi",
  25. "mod_status",
  26. "mod_secdownload",
  27. "mod_deflate",
  28. "mod_accesslog",
  29. )
  30. index-file.names = (
  31. "index.html",
  32. )
  33. accesslog.filename = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.access.log"
  34. mimetype.assign = (
  35. ".png" => "image/png",
  36. ".jpg" => "image/jpeg",
  37. ".jpeg" => "image/jpeg",
  38. ".gif" => "image/gif",
  39. ".html" => "text/html",
  40. ".htm" => "text/html",
  41. ".pdf" => "application/pdf",
  42. ".swf" => "application/x-shockwave-flash",
  43. ".spl" => "application/futuresplash",
  44. ".txt" => "text/plain",
  45. ".tar.gz" => "application/x-tgz",
  46. ".tgz" => "application/x-tgz",
  47. ".gz" => "application/x-gzip",
  48. ".c" => "text/plain",
  49. ".conf" => "text/plain",
  50. )
  51. setenv.add-environment = (
  52. "TRAC_ENV" => "tracenv",
  53. "SETENV" => "setenv",
  54. )
  55. setenv.set-environment = (
  56. "NEWENV" => "newenv",
  57. )
  58. setenv.add-request-header = (
  59. "FOO" => "foo",
  60. )
  61. setenv.set-request-header = (
  62. "FOO2" => "foo2",
  63. )
  64. setenv.add-response-header = (
  65. "BAR" => "foo",
  66. )
  67. setenv.set-response-header = (
  68. "BAR2" => "bar2",
  69. )
  70. $HTTP["url"] =~ "\.pdf$" {
  71. server.range-requests = "disable"
  72. }
  73. cgi.local-redir = "enable"
  74. cgi.assign = (
  75. ".pl" => env.PERL,
  76. ".cgi" => env.PERL,
  77. )
  78. extforward.headers = ( "Forwarded", "X-Forwarded-For" )
  79. extforward.forwarder = (
  80. "127.0.0.1" => "trust",
  81. "127.0.30.1" => "trust",
  82. )
  83. url.access-deny = (
  84. "~",
  85. ".inc",
  86. )
  87. expire.url = (
  88. "/expire/access" => "access 2 hours",
  89. "/expire/modification" => "access plus 1 seconds 2 minutes",
  90. )
  91. $HTTP["host"] == "symlink.example.org" {
  92. server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
  93. server.follow-symlink = "enable"
  94. }
  95. $HTTP["host"] == "nosymlink.example.org" {
  96. server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
  97. server.follow-symlink = "disable"
  98. }
  99. $HTTP["host"] == "no-simple.example.org" {
  100. server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/123.example.org/pages/"
  101. }
  102. else {
  103. simple-vhost.document-root = "pages"
  104. simple-vhost.server-root = env.SRCDIR + "/tmp/lighttpd/servers/"
  105. simple-vhost.default-host = "www.example.org"
  106. }
  107. $HTTP["host"] =~ "bug255\.example\.org$" {
  108. $HTTP["remoteip"] == "127.0.0.1" {
  109. url.access-deny = (
  110. "",
  111. )
  112. }
  113. }
  114. $HTTP["referer"] !~ "^($|http://referer\.example\.org)" {
  115. url.access-deny = (
  116. ".jpg",
  117. )
  118. }
  119. # deny access for all image stealers
  120. $HTTP["host"] == "referer.example.org" {
  121. $HTTP["referer"] !~ "^($|http://referer\.example\.org)" {
  122. url.access-deny = (
  123. ".png",
  124. )
  125. }
  126. }
  127. $HTTP["cookie"] =~ "empty-ref" {
  128. $HTTP["referer"] == "" {
  129. url.access-deny = (
  130. "",
  131. )
  132. }
  133. }
  134. $HTTP["host"] =~ "allow\.example\.org$" {
  135. url.access-allow = ( ".txt" ) # allow takes precedence over deny
  136. url.access-deny = ( ".txt" )
  137. }
  138. $HTTP["host"] == "cgi.example.org" {
  139. cgi.x-sendfile = "enable"
  140. }
  141. $HTTP["host"] == "errors.example.org" {
  142. $HTTP["url"] =~ "^/static/" {
  143. server.error-handler-404 = "/404.html"
  144. }
  145. else $HTTP["url"] =~ "^/dynamic/redirect_status/" {
  146. server.error-handler = "/404.pl"
  147. }
  148. else {
  149. server.error-handler-404 = "/404.pl"
  150. }
  151. }
  152. $HTTP["host"] == "lowercase-allow" {
  153. server.force-lowercase-filenames = "enable"
  154. }
  155. $HTTP["host"] == "lowercase-deny" {
  156. server.force-lowercase-filenames = "enable"
  157. url.access-deny = (
  158. ".jpg",
  159. )
  160. }
  161. $HTTP["host"] == "lowercase-exclude" {
  162. server.force-lowercase-filenames = "enable"
  163. static-file.exclude-extensions = (
  164. ".jpg",
  165. )
  166. }
  167. $HTTP["host"] == "lowercase-auth" {
  168. server.force-lowercase-filenames = "enable"
  169. auth.backend = "plain"
  170. auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user"
  171. auth.require = (
  172. "/image.jpg" => (
  173. "method" => "digest",
  174. "realm" => "download archiv",
  175. "require" => "valid-user",
  176. ),
  177. )
  178. }
  179. $HTTP["host"] =~ "^deflate(?:-cache)?\.example\.org$" {
  180. $HTTP["url"] == "/index.txt" {
  181. # (force Content-Type for test; do not copy)
  182. setenv.set-response-header = (
  183. "Content-Type" => "text/plain; charset=utf-8"
  184. )
  185. }
  186. deflate.mimetypes = (
  187. "text/plain",
  188. "text/html",
  189. )
  190. deflate.allowed-encodings = (
  191. "gzip",
  192. "deflate",
  193. )
  194. $HTTP["host"] == "deflate-cache.example.org" {
  195. deflate.cache-dir = env.SRCDIR + "/tmp/lighttpd/cache/compress/"
  196. }
  197. }
  198. $HTTP["host"] =~ "^auth-" {
  199. $HTTP["host"] == "auth-htpasswd.example.org" {
  200. auth.backend = "htpasswd"
  201. auth.backend.htpasswd.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.htpasswd"
  202. }
  203. $HTTP["host"] == "auth-plain.example.org" {
  204. auth.backend = "plain"
  205. auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user"
  206. }
  207. auth.require = (
  208. "/server-status" => (
  209. "method" => "digest",
  210. "realm" => "download archiv",
  211. "require" => "group=www|user=jan|host=192.168.2.10",
  212. ),
  213. "/server-config" => (
  214. "method" => "basic",
  215. "realm" => "download archiv",
  216. "require" => "valid-user",
  217. ),
  218. )
  219. status.status-url = "/server-status"
  220. status.config-url = "/server-config"
  221. }
  222. $HTTP["host"] == "vvv.example.org" {
  223. server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
  224. secdownload.secret = "verysecret"
  225. secdownload.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
  226. secdownload.uri-prefix = "/sec/"
  227. secdownload.timeout = 120
  228. secdownload.algorithm = "md5"
  229. }
  230. $HTTP["host"] == "vvv-sha1.example.org" {
  231. server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
  232. secdownload.secret = "verysecret"
  233. secdownload.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
  234. secdownload.uri-prefix = "/sec/"
  235. secdownload.timeout = 120
  236. secdownload.algorithm = "hmac-sha1"
  237. }
  238. $HTTP["host"] == "vvv-sha256.example.org" {
  239. server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
  240. secdownload.secret = "verysecret"
  241. secdownload.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
  242. secdownload.uri-prefix = "/sec/"
  243. secdownload.timeout = 120
  244. secdownload.algorithm = "hmac-sha256"
  245. secdownload.hash-querystr = "enable"
  246. }