lighttpd.conf 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. server.modules = (
  2. "mod_access",
  3. "mod_cgi",
  4. "mod_accesslog",
  5. "mod_rewrite",
  6. "mod_alias",
  7. "mod_auth",
  8. "mod_setenv",
  9. "mod_proxy",
  10. )
  11. server.document-root = "/www/htdocs"
  12. server.upload-dirs = ( "/www/tmp" )
  13. server.errorlog = "/www/log/error.log"
  14. server.pid-file = "/var/run/lighttpd.pid"
  15. server.username = "httpd"
  16. server.groupname = "nogroup"
  17. server.port = 80
  18. $HTTP["host"] != "superglue.local" {
  19. accesslog.filename = "/www/log/access.log"
  20. }
  21. dir-listing.activate = "enable"
  22. dir-listing.hide-dotfiles = "enable"
  23. index-file.names = (
  24. "index.html",
  25. "default.html",
  26. "failsafe.html"
  27. )
  28. cgi.assign = (
  29. ".sh" => "/bin/bash",
  30. ".cgi" => "",
  31. )
  32. url.access-deny = ( "~", ".inc", ".htaccess", ".htpasswd", "htpasswd", "/tmp/" )
  33. auth.backend = "htdigest"
  34. auth.backend.htdigest.userfile = "/etc/lighttpd/htpasswd"
  35. $HTTP["url"] =~ "^/admin$|^/admin/(.*)|^/log/(.*)$" {
  36. auth.require = ( "" => (
  37. "method" => "digest",
  38. "realm" => "superglue",
  39. "require" => "valid-user"
  40. )
  41. )
  42. }
  43. $HTTP["request-method"] == "POST" {
  44. auth.require = ( "" => (
  45. "method" => "digest",
  46. "realm" => "superglue",
  47. "require" => "valid-user"
  48. )
  49. )
  50. }
  51. ## defines var.superglueVersion from /etc/superglue_version
  52. include_shell "/etc/lighttpd/vars.sh"
  53. setenv.add-response-header += ( "X-Superglue-Version" => var.superglueVersion )
  54. $HTTP["request-method"] == "GET" {
  55. url.rewrite = (
  56. "^/resources/(.*)$" => "resources/$1",
  57. "^/devTools/(.*)$" => "devTools/$1",
  58. "^/templates/(.*)$" => "templates/$1",
  59. "^/extension/(.*)$" => "extension/$1"
  60. ),
  61. alias.url = (
  62. "/resources" => "/opt/lib/resources",
  63. "/devTools" => "/opt/lib/devTools",
  64. "/templates" => "/opt/lib/templates",
  65. "/extension" => "/opt/lib/extension"
  66. )
  67. ## override content and mime type for dotless files to text/html
  68. $HTTP["url"] !~ "(\.)" {
  69. $HTTP["url"] !~ "(^/admin)" {
  70. setenv.add-response-header += (
  71. "X-Superglue-Dotless" => "text/html Content-Type was forced",
  72. "Content-Type" => "text/html"
  73. )
  74. }
  75. }
  76. }
  77. $HTTP["url"] =~ "(^/admin)" {
  78. proxy.server = ( "" => ("admin" => ( "host" => "127.0.0.1", "port" => 81 )))
  79. }
  80. $HTTP["request-method"] == "POST" {
  81. alias.url = (
  82. "" => "/opt/lib/cgi/post.cgi"
  83. )
  84. }
  85. ## can use this? per
  86. ## https://dev.openwrt.org/browser/packages/net/lighttpd/files/lighttpd.conf?rev=38469
  87. # include_shell "cat /etc/lighttpd/conf.d/*.conf"
  88. ## reads optional conf files
  89. include_shell "/etc/lighttpd/opts.sh mime.conf compress.conf"