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