lighttpd.conf 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. index-file.names = (
  32. "index.html",
  33. "default.html"
  34. )
  35. cgi.assign = (
  36. ".sh" => "/bin/bash",
  37. ".cgi" => "",
  38. )
  39. url.access-deny = ( "~", ".inc", ".htaccess", ".htpasswd", "htpasswd", "/tmp/" )
  40. auth.backend = "htdigest"
  41. auth.backend.htdigest.userfile = "/opt/lib/htpasswd"
  42. $HTTP["url"] =~ "^/admin$|^/admin/(.*)|^/log/(.*)$" {
  43. auth.require = ( "" => (
  44. "method" => "digest",
  45. "realm" => "superglue",
  46. "require" => "valid-user"
  47. )
  48. )
  49. }
  50. $HTTP["request-method"] == "POST" {
  51. auth.require = ( "" => (
  52. "method" => "digest",
  53. "realm" => "superglue",
  54. "require" => "valid-user"
  55. )
  56. )
  57. }
  58. $HTTP["request-method"] == "GET" {
  59. url.rewrite = (
  60. "^/resources/(.*)$" => "resources/$1",
  61. "^/devTools/(.*)$" => "devTools/$1",
  62. "^/templates/(.*)$" => "templates/$1",
  63. "^/extension/(.*)$" => "extension/$1"
  64. ),
  65. alias.url = (
  66. "/resources" => "/opt/lib/resources",
  67. "/devTools" => "/opt/lib/devTools",
  68. "/templates" => "/opt/lib/templates",
  69. "/extension" => "/opt/lib/extension"
  70. )
  71. ## override content and mime type for dotless files to text/html
  72. $HTTP["url"] !~ "(\.)" {
  73. $HTTP["url"] !~ "(^/admin)" {
  74. setenv.add-response-header += (
  75. "X-Superglue-Dotless" => "text/html Content-Type was forced",
  76. "Content-Type" => "text/html"
  77. )
  78. }
  79. }
  80. }
  81. $HTTP["url"] =~ "(^/admin)" {
  82. proxy.server = ( "" => ("admin" => ( "host" => "127.0.0.1", "port" => 81 )))
  83. }
  84. $HTTP["request-method"] == "POST" {
  85. alias.url = (
  86. "" => "/opt/lib/cgi/post.cgi"
  87. )
  88. }
  89. ## can use this? per
  90. ## https://dev.openwrt.org/browser/packages/net/lighttpd/files/lighttpd.conf?rev=38469
  91. # include_shell "cat /etc/lighttpd/conf.d/*.conf"
  92. ## reads optional conf files
  93. include_shell "/etc/lighttpd/opts.sh mime.conf compress.conf"
  94. ## defines var.superglueVersion from /etc/superglue_version
  95. include_shell "/etc/lighttpd/vars.sh"
  96. setenv.add-response-header = ( "X-Superglue-Version" => var.superglueVersion )