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