1debug.log-request-handling = "enable" 2debug.log-request-header = "enable" 3debug.log-response-header = "enable" 4#debug.log-condition-handling = "enable" 5 6## 64 Mbyte ... nice limit 7server.max-request-size = 65000 8 9server.systemd-socket-activation = "enable" 10# optional bind spec override, e.g. for platforms without socket activation 11include env.SRCDIR + "/tmp/bind*.conf" 12 13server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" 14server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log" 15server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log" 16server.name = "www.example.org" 17server.tag = "lighttpd-1.4.x" 18 19server.feature-flags += ( "auth.delay-invalid-creds" => "disable" ) 20 21server.dir-listing = "enable" 22 23server.modules = ( 24 "mod_extforward", 25 "mod_auth", 26 "mod_authn_file", 27 "mod_setenv", 28 "mod_access", 29 "mod_expire", 30 "mod_simple_vhost", 31 "mod_cgi", 32 "mod_status", 33 "mod_deflate", 34 "mod_accesslog", 35) 36 37index-file.names = ( 38 "index.html", 39) 40 41accesslog.filename = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.access.log" 42 43mimetype.assign = ( 44 ".png" => "image/png", 45 ".jpg" => "image/jpeg", 46 ".jpeg" => "image/jpeg", 47 ".gif" => "image/gif", 48 ".html" => "text/html", 49 ".htm" => "text/html", 50 ".pdf" => "application/pdf", 51 ".swf" => "application/x-shockwave-flash", 52 ".spl" => "application/futuresplash", 53 ".txt" => "text/plain", 54 ".tar.gz" => "application/x-tgz", 55 ".tgz" => "application/x-tgz", 56 ".gz" => "application/x-gzip", 57 ".c" => "text/plain", 58 ".conf" => "text/plain", 59) 60 61setenv.add-environment = ( 62 "TRAC_ENV" => "tracenv", 63 "SETENV" => "setenv", 64) 65setenv.set-environment = ( 66 "NEWENV" => "newenv", 67 "BLANK_VALUE" => "", 68) 69setenv.add-request-header = ( 70 "FOO" => "foo", 71) 72setenv.set-request-header = ( 73 "FOO2" => "foo2", 74) 75setenv.add-response-header = ( 76 "BAR" => "foo", 77) 78setenv.set-response-header = ( 79 "BAR2" => "bar2", 80) 81 82$HTTP["url"] == "/range.disabled" { 83 server.range-requests = "disable" 84} 85 86cgi.local-redir = "enable" 87cgi.assign = ( 88 ".pl" => env.PERL, 89 ".cgi" => env.PERL, 90) 91 92extforward.headers = ( "Forwarded", "X-Forwarded-For" ) 93extforward.forwarder = ( 94 "127.0.0.1" => "trust", 95 "127.0.30.1" => "trust", 96) 97 98expire.url = ( 99 "/expire/access" => "access 2 hours", 100 "/expire/modification" => "access plus 1 seconds 2 minutes", 101) 102 103$HTTP["host"] == "symlink.example.org" { 104 server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" 105 server.follow-symlink = "enable" 106} 107 108$HTTP["host"] == "nosymlink.example.org" { 109 server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" 110 server.follow-symlink = "disable" 111} 112 113$HTTP["host"] == "no-simple.example.org" { 114 server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/123.example.org/pages/" 115} 116else { 117 simple-vhost.document-root = "pages" 118 simple-vhost.server-root = env.SRCDIR + "/tmp/lighttpd/servers/" 119 simple-vhost.default-host = "www.example.org" 120} 121 122$HTTP["host"] == "bug255.example.org" { 123 $HTTP["remoteip"] == "127.0.0.1" { 124 url.access-deny = ( 125 "", 126 ) 127 } 128} 129 130#$HTTP["referer"] !~ "^($|http://referer\.example\.org)" { 131$HTTP["referer"] =^ "http://referer.example.org" { 132} 133else $HTTP["referer"] == "" { 134} 135else { 136 url.access-deny = ( 137 ".jpg", 138 ) 139} 140 141# deny access for all image stealers 142$HTTP["host"] == "referer.example.org" { 143 #$HTTP["referer"] !~ "^($|http://referer\.example\.org)" { 144 $HTTP["referer"] =^ "http://referer.example.org" { 145 } 146 else $HTTP["referer"] == "" { 147 } 148 else { 149 url.access-deny = ( 150 ".png", 151 ) 152 } 153} 154 155$HTTP["cookie"] =~ "^empty-ref$" { 156 $HTTP["referer"] == "" { 157 url.access-deny = ( 158 "", 159 ) 160 } 161} 162 163$HTTP["host"] == "cgi.example.org" { 164 cgi.x-sendfile = "enable" 165} 166 167$HTTP["host"] == "errors.example.org" { 168 $HTTP["url"] =^ "/static/" { 169 server.error-handler-404 = "/404.html" 170 } 171 else $HTTP["url"] =^ "/dynamic/redirect_status/" { 172 server.error-handler = "/404.pl" 173 } 174 else { 175 server.error-handler-404 = "/404.pl" 176 } 177} 178 179$HTTP["host"] == "lowercase-allow" { 180 server.force-lowercase-filenames = "enable" 181} 182$HTTP["host"] == "lowercase-deny" { 183 server.force-lowercase-filenames = "enable" 184 url.access-deny = ( 185 ".jpg", 186 ) 187} 188$HTTP["host"] == "lowercase-exclude" { 189 server.force-lowercase-filenames = "enable" 190 static-file.exclude-extensions = ( 191 ".jpg", 192 ) 193} 194$HTTP["host"] == "lowercase-auth" { 195 server.force-lowercase-filenames = "enable" 196 auth.backend = "plain" 197 auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user" 198 auth.require = ( 199 "/image.jpg" => ( 200 "method" => "digest", 201 "realm" => "download archiv", 202 "require" => "valid-user", 203 ), 204 ) 205} 206 207deflate.allowed-encodings = ( 208 "gzip", 209 "deflate", 210) 211$HTTP["host"] == "deflate.example.org" { 212 $HTTP["url"] == "/index.txt" { 213 # (force Content-Type for test; do not copy) 214 setenv.set-response-header = ( 215 "Content-Type" => "text/plain; charset=utf-8" 216 ) 217 } 218 deflate.mimetypes = ( 219 "text/plain", 220 "text/html", 221 ) 222} 223$HTTP["host"] == "deflate-cache.example.org" { 224 deflate.mimetypes = ( 225 "text/plain", 226 "text/html", 227 ) 228 deflate.cache-dir = env.SRCDIR + "/tmp/lighttpd/cache/compress/" 229} 230 231$HTTP["host"] =~ "^auth-" { 232 $HTTP["host"] == "auth-htpasswd.example.org" { 233 auth.backend = "htpasswd" 234 auth.backend.htpasswd.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.htpasswd" 235 } 236 $HTTP["host"] == "auth-plain.example.org" { 237 auth.backend = "plain" 238 auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user" 239 } 240 auth.require = ( 241 "/server-status" => ( 242 "method" => "digest", 243 "realm" => "download archiv", 244 "require" => "group=www|user=jan|host=192.168.2.10", 245 ), 246 "/server-config" => ( 247 "method" => "basic", 248 "realm" => "download archiv", 249 "require" => "valid-user", 250 ), 251 ) 252 status.status-url = "/server-status" 253 status.config-url = "/server-config" 254} 255