lighttpd.conf 3.0 KB

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