| 1 | # lighttpd configuration file
|
|---|
| 2 | #
|
|---|
| 3 | ## modules to load
|
|---|
| 4 | # all other module should only be loaded if really neccesary
|
|---|
| 5 | # - saves some time
|
|---|
| 6 | # - saves memory
|
|---|
| 7 | #server.modules = (
|
|---|
| 8 | # "mod_rewrite",
|
|---|
| 9 | # "mod_redirect",
|
|---|
| 10 | # "mod_alias",
|
|---|
| 11 | # "mod_auth",
|
|---|
| 12 | # "mod_status",
|
|---|
| 13 | # "mod_setenv",
|
|---|
| 14 | # "mod_fastcgi",
|
|---|
| 15 | # "mod_proxy",
|
|---|
| 16 | # "mod_simple_vhost",
|
|---|
| 17 | # "mod_cgi",
|
|---|
| 18 | # "mod_ssi",
|
|---|
| 19 | # "mod_usertrack",
|
|---|
| 20 | # "mod_expire"
|
|---|
| 21 | #)
|
|---|
| 22 |
|
|---|
| 23 | ## a static document-root, for virtual-hosting take look at the
|
|---|
| 24 | ## server.virtual-* options
|
|---|
| 25 | server.document-root = "/www/"
|
|---|
| 26 |
|
|---|
| 27 | ## where to send error-messages to
|
|---|
| 28 | #server.errorlog = "/var/log/lighttpd/error.log"
|
|---|
| 29 |
|
|---|
| 30 | ## files to check for if .../ is requested
|
|---|
| 31 | index-file.names = ( "index.html", "default.html", "index.htm", "default.htm" )
|
|---|
| 32 |
|
|---|
| 33 | ## mimetype mapping
|
|---|
| 34 | mimetype.assign = (
|
|---|
| 35 | ".pdf" => "application/pdf",
|
|---|
| 36 | ".class" => "application/octet-stream",
|
|---|
| 37 | ".pac" => "application/x-ns-proxy-autoconfig",
|
|---|
| 38 | ".swf" => "application/x-shockwave-flash",
|
|---|
| 39 | ".wav" => "audio/x-wav",
|
|---|
| 40 | ".gif" => "image/gif",
|
|---|
| 41 | ".jpg" => "image/jpeg",
|
|---|
| 42 | ".jpeg" => "image/jpeg",
|
|---|
| 43 | ".png" => "image/png",
|
|---|
| 44 | ".css" => "text/css",
|
|---|
| 45 | ".html" => "text/html",
|
|---|
| 46 | ".htm" => "text/html",
|
|---|
| 47 | ".js" => "text/javascript",
|
|---|
| 48 | ".txt" => "text/plain",
|
|---|
| 49 | ".dtd" => "text/xml",
|
|---|
| 50 | ".xml" => "text/xml"
|
|---|
| 51 | )
|
|---|
| 52 |
|
|---|
| 53 | ## Use the "Content-Type" extended attribute to obtain mime type if possible
|
|---|
| 54 | #mimetypes.use-xattr = "enable"
|
|---|
| 55 |
|
|---|
| 56 | ## send a different Server: header
|
|---|
| 57 | ## be nice and keep it at lighttpd
|
|---|
| 58 | #server.tag = "lighttpd"
|
|---|
| 59 |
|
|---|
| 60 | $HTTP["url"] =~ "\.pdf$" {
|
|---|
| 61 | server.range-requests = "disable"
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | ##
|
|---|
| 65 | # which extensions should not be handle via static-file transfer
|
|---|
| 66 | #
|
|---|
| 67 | # .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
|
|---|
| 68 | static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
|
|---|
| 69 |
|
|---|
| 70 | ######### Options that are good to be but not neccesary to be changed #######
|
|---|
| 71 |
|
|---|
| 72 | ## bind to port (default: 80)
|
|---|
| 73 | #server.port = 81
|
|---|
| 74 |
|
|---|
| 75 | ## bind to localhost (default: all interfaces)
|
|---|
| 76 | #server.bind = "localhost"
|
|---|
| 77 |
|
|---|
| 78 | ## error-handler for status 404
|
|---|
| 79 | #server.error-handler-404 = "/error-handler.html"
|
|---|
| 80 | #server.error-handler-404 = "/error-handler.php"
|
|---|
| 81 |
|
|---|
| 82 | ## to help the rc.scripts
|
|---|
| 83 | server.pid-file = "/var/run/lighttpd.pid"
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 | ###### virtual hosts
|
|---|
| 87 | ##
|
|---|
| 88 | ## If you want name-based virtual hosting add the next three settings and load
|
|---|
| 89 | ## mod_simple_vhost
|
|---|
| 90 | ##
|
|---|
| 91 | ## document-root =
|
|---|
| 92 | ## virtual-server-root + virtual-server-default-host + virtual-server-docroot or
|
|---|
| 93 | ## virtual-server-root + http-host + virtual-server-docroot
|
|---|
| 94 | ##
|
|---|
| 95 | #simple-vhost.server-root = "/home/weigon/wwwroot/servers/"
|
|---|
| 96 | #simple-vhost.default-host = "grisu.home.kneschke.de"
|
|---|
| 97 | #simple-vhost.document-root = "/pages/"
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 | ##
|
|---|
| 101 | ## Format: <errorfile-prefix><status>.html
|
|---|
| 102 | ## -> ..../status-404.html for 'File not found'
|
|---|
| 103 | #server.errorfile-prefix = "/www/error-"
|
|---|
| 104 |
|
|---|
| 105 | ## virtual directory listings
|
|---|
| 106 | #server.dir-listing = "enable"
|
|---|
| 107 |
|
|---|
| 108 | ## send unhandled HTTP-header headers to error-log
|
|---|
| 109 | #debug.dump-unknown-headers = "enable"
|
|---|
| 110 |
|
|---|
| 111 | ### only root can use these options
|
|---|
| 112 | #
|
|---|
| 113 | # chroot() to directory (default: no chroot() )
|
|---|
| 114 | #server.chroot = "/"
|
|---|
| 115 |
|
|---|
| 116 | ## change uid to <uid> (default: don't care)
|
|---|
| 117 | #server.username = "nobody"
|
|---|
| 118 |
|
|---|
| 119 | ## change uid to <uid> (default: don't care)
|
|---|
| 120 | #server.groupname = "nobody"
|
|---|
| 121 |
|
|---|
| 122 | #### compress module
|
|---|
| 123 | #compress.cache-dir = "/dev/null/"
|
|---|
| 124 | #compress.filetype = ("text/plain", "text/html")
|
|---|
| 125 |
|
|---|
| 126 | #### proxy module
|
|---|
| 127 | ## read proxy.txt for more info
|
|---|
| 128 | #proxy.server = (
|
|---|
| 129 | # ".php" => (
|
|---|
| 130 | # "localhost" => (
|
|---|
| 131 | # "host" => "192.168.0.101",
|
|---|
| 132 | # "port" => 80
|
|---|
| 133 | # )
|
|---|
| 134 | # )
|
|---|
| 135 | #)
|
|---|
| 136 |
|
|---|
| 137 | #### fastcgi module
|
|---|
| 138 | ## read fastcgi.txt for more info
|
|---|
| 139 | #fastcgi.server = (
|
|---|
| 140 | # ".php" => (
|
|---|
| 141 | # "localhost" => (
|
|---|
| 142 | # "socket" => "/tmp/php-fastcgi.socket",
|
|---|
| 143 | # "bin-path" => "/usr/local/bin/php"
|
|---|
| 144 | # )
|
|---|
| 145 | # )
|
|---|
| 146 | #)
|
|---|
| 147 |
|
|---|
| 148 | #### CGI module
|
|---|
| 149 | #cgi.assign = ( ".pl" => "/usr/bin/perl", ".cgi" => "/usr/bin/perl" )
|
|---|
| 150 |
|
|---|
| 151 | #### SSL engine
|
|---|
| 152 | #ssl.engine = "enable"
|
|---|
| 153 | #ssl.pemfile = "server.pem"
|
|---|
| 154 |
|
|---|
| 155 | #### status module
|
|---|
| 156 | #status.status-url = "/server-status"
|
|---|
| 157 | #status.config-url = "/server-config"
|
|---|
| 158 |
|
|---|
| 159 | #### auth module
|
|---|
| 160 | ## read authentification.txt for more info
|
|---|
| 161 | #auth.backend = "plain"
|
|---|
| 162 | #auth.backend.plain.userfile = "lighttpd.user"
|
|---|
| 163 | #auth.backend.plain.groupfile = "lighttpd.group"
|
|---|
| 164 | #auth.require = (
|
|---|
| 165 | # "/server-status" => (
|
|---|
| 166 | # "method" => "digest",
|
|---|
| 167 | # "realm" => "download archiv",
|
|---|
| 168 | # "require" => "group=www|user=jan|host=192.168.2.10"
|
|---|
| 169 | # ),
|
|---|
| 170 | # "/server-info" => (
|
|---|
| 171 | # "method" => "digest",
|
|---|
| 172 | # "realm" => "download archiv",
|
|---|
| 173 | # "require" => "group=www|user=jan|host=192.168.2.10"
|
|---|
| 174 | # )
|
|---|
| 175 | #)
|
|---|
| 176 |
|
|---|
| 177 | #### url handling modules (rewrite, redirect, access)
|
|---|
| 178 | #url.rewrite = ( "^/$" => "/server-status" )
|
|---|
| 179 | #url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )
|
|---|
| 180 |
|
|---|
| 181 | #### both rewrite/redirect support back reference to regex conditional using %n
|
|---|
| 182 | #$HTTP["host"] =~ "^www\.(.*)" {
|
|---|
| 183 | # url.redirect = ( "^/(.*)" => "http://%1/$1" )
|
|---|
| 184 | #}
|
|---|
| 185 |
|
|---|
| 186 | #### expire module
|
|---|
| 187 | #expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")
|
|---|
| 188 |
|
|---|
| 189 | #### ssi
|
|---|
| 190 | #ssi.extension = ( ".shtml" )
|
|---|
| 191 |
|
|---|
| 192 | #### setenv
|
|---|
| 193 | #setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" )
|
|---|
| 194 | #setenv.add-response-header = ( "X-Secret-Message" => "42" )
|
|---|
| 195 |
|
|---|
| 196 | #### variable usage:
|
|---|
| 197 | ## variable name without "." is auto prefixed by "var." and becomes "var.bar"
|
|---|
| 198 | #bar = 1
|
|---|
| 199 | #var.mystring = "foo"
|
|---|
| 200 |
|
|---|
| 201 | ## integer add
|
|---|
| 202 | #bar += 1
|
|---|
| 203 | ## string concat, with integer cast as string, result: "www.foo1.com"
|
|---|
| 204 | #server.name = "www." + mystring + var.bar + ".com"
|
|---|
| 205 | ## array merge
|
|---|
| 206 | #index-file.names = (foo + ".php") + index-file.names
|
|---|
| 207 | #index-file.names += (foo + ".php")
|
|---|
| 208 |
|
|---|
| 209 | #### include
|
|---|
| 210 | #include /etc/lighttpd/lighttpd-inc.conf
|
|---|
| 211 | ## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
|
|---|
| 212 | #include "lighttpd-inc.conf"
|
|---|
| 213 |
|
|---|
| 214 | #### include_shell
|
|---|
| 215 | #include_shell "echo var.a=1"
|
|---|
| 216 | ## the above is same as:
|
|---|
| 217 | #var.a=1
|
|---|