lighttpd.conf 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. $HTTP["request-method"] == "GET" {
  52. url.rewrite = (
  53. "^/resources/(.*)$" => "resources/$1",
  54. "^/devTools/(.*)$" => "devTools/$1",
  55. "^/templates/(.*)$" => "templates/$1",
  56. "^/extension/(.*)$" => "extension/$1"
  57. ),
  58. alias.url = (
  59. "/resources" => "/opt/lib/resources",
  60. "/devTools" => "/opt/lib/devTools",
  61. "/templates" => "/opt/lib/templates",
  62. "/extension" => "/opt/lib/extension"
  63. )
  64. ## override content and mime type for dotless files to text/html
  65. $HTTP["url"] !~ "(\.)" {
  66. $HTTP["url"] !~ "(^/admin)" {
  67. setenv.add-response-header += (
  68. "X-Superglue-Dotless" => "text/html Content-Type was forced",
  69. "Content-Type" => "text/html"
  70. )
  71. }
  72. }
  73. }
  74. $HTTP["url"] =~ "(^/admin)" {
  75. proxy.server = ( "" => ("admin" => ( "host" => "127.0.0.1", "port" => 81 )))
  76. }
  77. $HTTP["request-method"] == "POST" {
  78. alias.url = (
  79. "" => "/opt/lib/cgi/post.cgi"
  80. )
  81. }
  82. ## can use this? per
  83. ## https://dev.openwrt.org/browser/packages/net/lighttpd/files/lighttpd.conf?rev=38469
  84. # include_shell "cat /etc/lighttpd/conf.d/*.conf"
  85. ## reads optional conf files
  86. include_shell "/etc/lighttpd/opts.sh mime.conf compress.conf"
  87. ## defines var.superglueVersion from /etc/superglue_version
  88. include_shell "/etc/lighttpd/vars.sh"
  89. setenv.add-response-header = ( "X-Superglue-Version" => var.superglueVersion )