| 1 | # lighttpd configuration file |
|---|
| 2 | # |
|---|
| 3 | # use it as a base for lighttpd 1.0.0 and above |
|---|
| 4 | # |
|---|
| 5 | # $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $ |
|---|
| 6 | |
|---|
| 7 | ############ Options you really have to take care of #################### |
|---|
| 8 | |
|---|
| 9 | ## modules to load |
|---|
| 10 | # at least mod_access and mod_accesslog should be loaded |
|---|
| 11 | # all other module should only be loaded if really neccesary |
|---|
| 12 | # - saves some time |
|---|
| 13 | # - saves memory |
|---|
| 14 | server.modules = ( |
|---|
| 15 | # "mod_rewrite", |
|---|
| 16 | # "mod_redirect", |
|---|
| 17 | # "mod_alias", |
|---|
| 18 | "mod_access", |
|---|
| 19 | # "mod_trigger_b4_dl", |
|---|
| 20 | # "mod_auth", |
|---|
| 21 | # "mod_status", |
|---|
| 22 | # "mod_setenv", |
|---|
| 23 | # "mod_proxy_core", |
|---|
| 24 | # "mod_proxy_backend_http", |
|---|
| 25 | # "mod_proxy_backend_fastcgi", |
|---|
| 26 | # "mod_proxy_backend_scgi", |
|---|
| 27 | # "mod_proxy_backend_ajp13", |
|---|
| 28 | # "mod_simple_vhost", |
|---|
| 29 | # "mod_evhost", |
|---|
| 30 | # "mod_userdir", |
|---|
| 31 | # "mod_cgi", |
|---|
| 32 | # "mod_compress", |
|---|
| 33 | # "mod_ssi", |
|---|
| 34 | # "mod_usertrack", |
|---|
| 35 | # "mod_expire", |
|---|
| 36 | # "mod_secdownload", |
|---|
| 37 | # "mod_rrdtool", |
|---|
| 38 | "mod_accesslog" ) |
|---|
| 39 | |
|---|
| 40 | ## a static document-root, for virtual-hosting take look at the |
|---|
| 41 | ## server.virtual-* options |
|---|
| 42 | server.document-root = "/www/pages/" |
|---|
| 43 | |
|---|
| 44 | ## where to send error-messages to |
|---|
| 45 | server.errorlog = "/www/logs/lighttpd.error.log" |
|---|
| 46 | |
|---|
| 47 | # files to check for if .../ is requested |
|---|
| 48 | index-file.names = ( "index.php", "index.html", |
|---|
| 49 | "index.htm", "default.htm" ) |
|---|
| 50 | |
|---|
| 51 | ## set the event-handler (read the performance section in the manual) |
|---|
| 52 | # server.event-handler = "freebsd-kqueue" # needed on OS X |
|---|
| 53 | |
|---|
| 54 | # mimetype mapping |
|---|
| 55 | mimetype.assign = ( |
|---|
| 56 | ".pdf" => "application/pdf", |
|---|
| 57 | ".sig" => "application/pgp-signature", |
|---|
| 58 | ".spl" => "application/futuresplash", |
|---|
| 59 | ".class" => "application/octet-stream", |
|---|
| 60 | ".ps" => "application/postscript", |
|---|
| 61 | ".torrent" => "application/x-bittorrent", |
|---|
| 62 | ".dvi" => "application/x-dvi", |
|---|
| 63 | ".gz" => "application/x-gzip", |
|---|
| 64 | ".pac" => "application/x-ns-proxy-autoconfig", |
|---|
| 65 | ".swf" => "application/x-shockwave-flash", |
|---|
| 66 | ".tar.gz" => "application/x-tgz", |
|---|
| 67 | ".tgz" => "application/x-tgz", |
|---|
| 68 | ".tar" => "application/x-tar", |
|---|
| 69 | ".zip" => "application/zip", |
|---|
| 70 | ".mp3" => "audio/mpeg", |
|---|
| 71 | ".m3u" => "audio/x-mpegurl", |
|---|
| 72 | ".wma" => "audio/x-ms-wma", |
|---|
| 73 | ".wax" => "audio/x-ms-wax", |
|---|
| 74 | ".ogg" => "application/ogg", |
|---|
| 75 | ".wav" => "audio/x-wav", |
|---|
| 76 | ".gif" => "image/gif", |
|---|
| 77 | ".jar" => "application/x-java-archive", |
|---|
| 78 | ".jpg" => "image/jpeg", |
|---|
| 79 | ".jpeg" => "image/jpeg", |
|---|
| 80 | ".png" => "image/png", |
|---|
| 81 | ".xbm" => "image/x-xbitmap", |
|---|
| 82 | ".xpm" => "image/x-xpixmap", |
|---|
| 83 | ".xwd" => "image/x-xwindowdump", |
|---|
| 84 | ".css" => "text/css", |
|---|
| 85 | ".html" => "text/html", |
|---|
| 86 | ".htm" => "text/html", |
|---|
| 87 | ".js" => "text/javascript", |
|---|
| 88 | ".asc" => "text/plain", |
|---|
| 89 | ".c" => "text/plain", |
|---|
| 90 | ".cpp" => "text/plain", |
|---|
| 91 | ".log" => "text/plain", |
|---|
| 92 | ".conf" => "text/plain", |
|---|
| 93 | ".text" => "text/plain", |
|---|
| 94 | ".txt" => "text/plain", |
|---|
| 95 | ".dtd" => "text/xml", |
|---|
| 96 | ".xml" => "text/xml", |
|---|
| 97 | ".mpeg" => "video/mpeg", |
|---|
| 98 | ".mpg" => "video/mpeg", |
|---|
| 99 | ".mov" => "video/quicktime", |
|---|
| 100 | ".qt" => "video/quicktime", |
|---|
| 101 | ".avi" => "video/x-msvideo", |
|---|
| 102 | ".asf" => "video/x-ms-asf", |
|---|
| 103 | ".asx" => "video/x-ms-asf", |
|---|
| 104 | ".wmv" => "video/x-ms-wmv", |
|---|
| 105 | ".bz2" => "application/x-bzip", |
|---|
| 106 | ".tbz" => "application/x-bzip-compressed-tar", |
|---|
| 107 | ".tar.bz2" => "application/x-bzip-compressed-tar" |
|---|
| 108 | ) |
|---|
| 109 | |
|---|
| 110 | # Use the "Content-Type" extended attribute to obtain mime type if possible |
|---|
| 111 | #mimetype.use-xattr = "enable" |
|---|
| 112 | |
|---|
| 113 | |
|---|
| 114 | ## send a different Server: header |
|---|
| 115 | ## be nice and keep it at lighttpd |
|---|
| 116 | # server.tag = "lighttpd" |
|---|
| 117 | |
|---|
| 118 | #### accesslog module |
|---|
| 119 | accesslog.filename = "/www/logs/access.log" |
|---|
| 120 | |
|---|
| 121 | ## deny access the file-extensions |
|---|
| 122 | # |
|---|
| 123 | # ~ is for backupfiles from vi, emacs, joe, ... |
|---|
| 124 | # .inc is often used for code includes which should in general not be part |
|---|
| 125 | # of the document-root |
|---|
| 126 | url.access-deny = ( "~", ".inc" ) |
|---|
| 127 | |
|---|
| 128 | $HTTP["url"] =~ "\.pdf$" { |
|---|
| 129 | server.range-requests = "disable" |
|---|
| 130 | } |
|---|
| 131 | |
|---|
| 132 | ## |
|---|
| 133 | # which extensions should not be handle via static-file transfer |
|---|
| 134 | # |
|---|
| 135 | # .php, .pl, .fcgi are most often handled by mod_proxy_core or mod_cgi |
|---|
| 136 | static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) |
|---|
| 137 | |
|---|
| 138 | ######### Options that are good to be but not neccesary to be changed ####### |
|---|
| 139 | |
|---|
| 140 | ## bind to port (default: 80) |
|---|
| 141 | #server.port = 81 |
|---|
| 142 | |
|---|
| 143 | ## bind to localhost (default: all interfaces) |
|---|
| 144 | #server.bind = "grisu.home.kneschke.de" |
|---|
| 145 | |
|---|
| 146 | ## error-handler for status 404 |
|---|
| 147 | #server.error-handler-404 = "/error-handler.html" |
|---|
| 148 | #server.error-handler-404 = "/error-handler.php" |
|---|
| 149 | |
|---|
| 150 | ## to help the rc.scripts |
|---|
| 151 | #server.pid-file = "/var/run/lighttpd.pid" |
|---|
| 152 | |
|---|
| 153 | |
|---|
| 154 | ###### virtual hosts |
|---|
| 155 | ## |
|---|
| 156 | ## If you want name-based virtual hosting add the next three settings and load |
|---|
| 157 | ## mod_simple_vhost |
|---|
| 158 | ## |
|---|
| 159 | ## document-root = |
|---|
| 160 | ## virtual-server-root + virtual-server-default-host + virtual-server-docroot |
|---|
| 161 | ## or |
|---|
| 162 | ## virtual-server-root + http-host + virtual-server-docroot |
|---|
| 163 | ## |
|---|
| 164 | #simple-vhost.server-root = "/home/weigon/wwwroot/servers/" |
|---|
| 165 | #simple-vhost.default-host = "grisu.home.kneschke.de" |
|---|
| 166 | #simple-vhost.document-root = "/pages/" |
|---|
| 167 | |
|---|
| 168 | |
|---|
| 169 | ## |
|---|
| 170 | ## Format: <errorfile-prefix><status-code>.html |
|---|
| 171 | ## -> ..../status-404.html for 'File not found' |
|---|
| 172 | #server.errorfile-prefix = "/home/weigon/projects/lighttpd/doc/status-" |
|---|
| 173 | |
|---|
| 174 | ## virtual directory listings |
|---|
| 175 | #dir-listing.activate = "enable" |
|---|
| 176 | |
|---|
| 177 | ## enable debugging |
|---|
| 178 | #debug.log-request-header = "enable" |
|---|
| 179 | #debug.log-response-header = "enable" |
|---|
| 180 | #debug.log-request-handling = "enable" |
|---|
| 181 | #debug.log-file-not-found = "enable" |
|---|
| 182 | #debug.log-condition-handling = "enable" |
|---|
| 183 | |
|---|
| 184 | ### only root can use these options |
|---|
| 185 | # |
|---|
| 186 | # chroot() to directory (default: no chroot() ) |
|---|
| 187 | #server.chroot = "/" |
|---|
| 188 | |
|---|
| 189 | ## change uid to <uid> (default: don't care) |
|---|
| 190 | #server.username = "wwwrun" |
|---|
| 191 | |
|---|
| 192 | ## change uid to <uid> (default: don't care) |
|---|
| 193 | #server.groupname = "wwwrun" |
|---|
| 194 | |
|---|
| 195 | #### compress module |
|---|
| 196 | #compress.cache-dir = "/tmp/lighttpd/cache/compress/" |
|---|
| 197 | #compress.filetype = ("text/plain", "text/html") |
|---|
| 198 | |
|---|
| 199 | #### mod-proxy-core module |
|---|
| 200 | ## read mod-proxy-core.txt for more info |
|---|
| 201 | ## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini |
|---|
| 202 | #$PHYSICAL["existing-path"] =~ "\.php$" { |
|---|
| 203 | # proxy-core.balancer = "round-robin" |
|---|
| 204 | # proxy-core.allow-x-sendfile = "enable" |
|---|
| 205 | # proxy-core.protocol = "fastcgi" |
|---|
| 206 | # proxy-core.backends = ( "unix:/tmp/php-fastcgi.sock" ) |
|---|
| 207 | # proxy-core.max-pool-size = 16 |
|---|
| 208 | #} |
|---|
| 209 | |
|---|
| 210 | |
|---|
| 211 | #### CGI module |
|---|
| 212 | #cgi.assign = ( ".pl" => "/usr/bin/perl", |
|---|
| 213 | # ".cgi" => "/usr/bin/perl" ) |
|---|
| 214 | # |
|---|
| 215 | |
|---|
| 216 | #### SSL engine |
|---|
| 217 | #ssl.engine = "enable" |
|---|
| 218 | #ssl.pemfile = "server.pem" |
|---|
| 219 | |
|---|
| 220 | #### status module |
|---|
| 221 | #status.status-url = "/server-status" |
|---|
| 222 | #status.config-url = "/server-config" |
|---|
| 223 | |
|---|
| 224 | #### auth module |
|---|
| 225 | ## read authentication.txt for more info |
|---|
| 226 | #auth.backend = "plain" |
|---|
| 227 | #auth.backend.plain.userfile = "lighttpd.user" |
|---|
| 228 | #auth.backend.plain.groupfile = "lighttpd.group" |
|---|
| 229 | |
|---|
| 230 | #auth.backend.ldap.hostname = "localhost" |
|---|
| 231 | #auth.backend.ldap.base-dn = "dc=my-domain,dc=com" |
|---|
| 232 | #auth.backend.ldap.filter = "(uid=$)" |
|---|
| 233 | |
|---|
| 234 | #auth.require = ( "/server-status" => |
|---|
| 235 | # ( |
|---|
| 236 | # "method" => "digest", |
|---|
| 237 | # "realm" => "download archiv", |
|---|
| 238 | # "require" => "user=jan" |
|---|
| 239 | # ), |
|---|
| 240 | # "/server-config" => |
|---|
| 241 | # ( |
|---|
| 242 | # "method" => "digest", |
|---|
| 243 | # "realm" => "download archiv", |
|---|
| 244 | # "require" => "valid-user" |
|---|
| 245 | # ) |
|---|
| 246 | # ) |
|---|
| 247 | |
|---|
| 248 | #### url handling modules (rewrite, redirect, access) |
|---|
| 249 | #url.rewrite = ( "^/$" => "/server-status" ) |
|---|
| 250 | #url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" ) |
|---|
| 251 | #### both rewrite/redirect support back reference to regex conditional using %n |
|---|
| 252 | #$HTTP["host"] =~ "^www\.(.*)" { |
|---|
| 253 | # url.redirect = ( "^/(.*)" => "http://%1/$1" ) |
|---|
| 254 | #} |
|---|
| 255 | |
|---|
| 256 | # |
|---|
| 257 | # define a pattern for the host url finding |
|---|
| 258 | # %% => % sign |
|---|
| 259 | # %0 => domain name + tld |
|---|
| 260 | # %1 => tld |
|---|
| 261 | # %2 => domain name without tld |
|---|
| 262 | # %3 => subdomain 1 name |
|---|
| 263 | # %4 => subdomain 2 name |
|---|
| 264 | # |
|---|
| 265 | #evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/" |
|---|
| 266 | |
|---|
| 267 | #### expire module |
|---|
| 268 | #expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes") |
|---|
| 269 | |
|---|
| 270 | #### ssi |
|---|
| 271 | #ssi.extension = ( ".shtml" ) |
|---|
| 272 | |
|---|
| 273 | #### rrdtool |
|---|
| 274 | #rrdtool.binary = "/usr/bin/rrdtool" |
|---|
| 275 | #rrdtool.db-name = "/var/www/lighttpd.rrd" |
|---|
| 276 | |
|---|
| 277 | #### setenv |
|---|
| 278 | #setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" ) |
|---|
| 279 | #setenv.add-response-header = ( "X-Secret-Message" => "42" ) |
|---|
| 280 | |
|---|
| 281 | ## for mod_trigger_b4_dl |
|---|
| 282 | # trigger-before-download.gdbm-filename = "/home/weigon/testbase/trigger.db" |
|---|
| 283 | # trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" ) |
|---|
| 284 | # trigger-before-download.trigger-url = "^/trigger/" |
|---|
| 285 | # trigger-before-download.download-url = "^/download/" |
|---|
| 286 | # trigger-before-download.deny-url = "http://127.0.0.1/index.html" |
|---|
| 287 | # trigger-before-download.trigger-timeout = 10 |
|---|
| 288 | |
|---|
| 289 | #### variable usage: |
|---|
| 290 | ## variable name without "." is auto prefixed by "var." and becomes "var.bar" |
|---|
| 291 | #bar = 1 |
|---|
| 292 | #var.mystring = "foo" |
|---|
| 293 | |
|---|
| 294 | ## integer add |
|---|
| 295 | #bar += 1 |
|---|
| 296 | ## string concat, with integer cast as string, result: "www.foo1.com" |
|---|
| 297 | #server.name = "www." + mystring + var.bar + ".com" |
|---|
| 298 | ## array merge |
|---|
| 299 | #index-file.names = (foo + ".php") + index-file.names |
|---|
| 300 | #index-file.names += (foo + ".php") |
|---|
| 301 | |
|---|
| 302 | #### include |
|---|
| 303 | #include /etc/lighttpd/lighttpd-inc.conf |
|---|
| 304 | ## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf" |
|---|
| 305 | #include "lighttpd-inc.conf" |
|---|
| 306 | |
|---|
| 307 | #### include_shell |
|---|
| 308 | #include_shell "echo var.a=1" |
|---|
| 309 | ## the above is same as: |
|---|
| 310 | #var.a=1 |
|---|