1 # lighttpd configuration file
3 # use it as a base for lighttpd 1.0.0 and above
5 # $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $
7 ############ Options you really have to take care of ####################
10 # at least mod_access and mod_accesslog should be loaded
11 # all other module should only be loaded if really neccesary
20 # "mod_trigger_b4_dl",
38 ## a static document-root, for virtual-hosting take look at the
39 ## server.virtual-* options
40 server.document-root = "/srv/http/"
42 ## where to send error-messages to
43 server.errorlog = "/var/log/lighttpd/error.log"
45 # files to check for if .../ is requested
46 index-file.names = ( "index.html", "index.html", "index.sh",
47 "index.u", "index.php", "index.cgi" )
49 ## set the event-handler (read the performance section in the manual)
50 # server.event-handler = "freebsd-kqueue" # needed on OS X
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",
83 ".html" => "text/html",
84 ".htm" => "text/html",
85 ".js" => "text/javascript",
86 ".asc" => "text/plain",
88 ".cpp" => "text/plain",
89 ".log" => "text/plain",
90 ".conf" => "text/plain",
91 ".text" => "text/plain",
92 ".txt" => "text/plain",
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",
107 "" => "application/octet-stream",
110 # Use the "Content-Type" extended attribute to obtain mime type if possible
111 #mimetype.use-xattr = "enable"
114 ## send a different Server: header
115 ## be nice and keep it at lighttpd
116 # server.tag = "lighttpd"
118 #### accesslog module
119 accesslog.filename = "/var/log/lighttpd/access.log"
121 ## deny access the file-extensions
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 = ( ".lua", "~", ".inc", ".cnf", )
128 $HTTP["url"] =~ "\.pdf$" {
129 server.range-requests = "disable"
133 # which extensions should not be handle via static-file transfer
135 # .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
136 static-file.exclude-extensions = ( ".u", ".sh", ".php", ".pl", ".fcgi", ".cgi" )
138 ######### Options that are good to be but not neccesary to be changed #######
140 ## bind to port (default: 80)
142 server.dir-listing = "enable"
143 dir-listing.encoding = "GB2312"
145 # $HTTP["url"] =~ "^/*" {
146 # url.redirect = ( "^/(.*)" => "https://192.168.3.224/$1" )
149 ## bind to localhost (default: all interfaces)
150 #server.bind = "127.0.0.1"
152 ## error-handler for status 404
153 #server.error-handler-404 = "/error-handler.html"
154 #server.error-handler-404 = "/error-handler.php"
156 ## to help the rc.scripts
157 server.pid-file = "/var/run/lighttpd/lighttpd.pid"
162 ## If you want name-based virtual hosting add the next three settings and load
166 ## virtual-server-root + virtual-server-default-host + virtual-server-docroot
168 ## virtual-server-root + http-host + virtual-server-docroot
170 #simple-vhost.server-root = "/srv/http/vhosts/"
171 #simple-vhost.default-host = "www.example.org"
172 #simple-vhost.document-root = "/htdocs/"
176 ## Format: <errorfile-prefix><status-code>.html
177 ## -> ..../status-404.html for 'File not found'
178 #server.errorfile-prefix = "/usr/share/lighttpd/errors/status-"
179 #server.errorfile-prefix = "/srv/http/errors/status-"
181 ## virtual directory listings
182 dir-listing.activate = "enable"
185 #debug.log-request-header = "enable"
186 #debug.log-response-header = "enable"
187 #debug.log-request-handling = "enable"
188 #debug.log-file-not-found = "enable"
190 ### only root can use these options
192 # chroot() to directory (default: no chroot() )
195 ## change uid to <uid> (default: don't care)
196 server.username = "http"
198 ## change uid to <uid> (default: don't care)
199 server.groupname = "http"
202 #compress.cache-dir = "/var/cache/lighttpd/compress/"
203 #compress.filetype = ("text/plain", "text/html")
206 ## read proxy.txt for more info
207 #proxy.server = ( ".php" =>
210 # "host" => "192.168.0.101",
217 ## read fastcgi.txt for more info
218 ## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
219 #fastcgi.server = ( ".php" =>
222 # "socket" => "/var/run/lighttpd/php-fastcgi.socket",
223 # "bin-path" => "/usr/bin/php-cgi"
229 #cgi.assign = ( ".pl" => "/usr/bin/perl",
230 # ".cgi" => "/usr/bin/perl" )
232 cgi.assign = ( ".u" => "/usr/bin/lua",
238 # ssl.engine = "enable"
239 # ssl.pemfile = "/etc/lighttpd/ssl/server.pem"
240 #ssl.pemfile = "/etc/ssl/private/lighttpd.pem"
241 # $SERVER["socket"] == "192.168.3.224:82" {
242 $SERVER["socket"] == "0.0.0.0:82" {
243 server.document-root = "/srv/http"
244 ssl.engine = "enable"
245 ssl.pemfile = "/etc/lighttpd/ssl/server.pem"
249 #status.status-url = "/server-status"
250 #status.config-url = "/server-config"
253 ## read authentication.txt for more info
254 auth.backend = "htdigest"
255 auth.backend.htdigest.userfile = "/etc/lighttpd/.passwd"
257 auth.require = ( "/" =>
259 "method" => "digest",
260 "realm" => "authorized users only",
261 "require" => "valid-user"
265 #auth.backend = "plain"
266 #auth.backend.plain.userfile = "lighttpd.user"
267 #auth.backend.plain.groupfile = "lighttpd.group"
269 #auth.backend.ldap.hostname = "localhost"
270 #auth.backend.ldap.base-dn = "dc=my-domain,dc=com"
271 #auth.backend.ldap.filter = "(uid=$)"
273 #auth.require = ( "/server-status" =>
275 # "method" => "digest",
276 # "realm" => "download archiv",
277 # "require" => "user=jan"
279 # "/server-config" =>
281 # "method" => "digest",
282 # "realm" => "download archiv",
283 # "require" => "valid-user"
287 #### url handling modules (rewrite, redirect, access)
288 #url.rewrite = ( "^/$" => "/server-status" )
289 #url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )
290 #### both rewrite/redirect support back reference to regex conditional using %n
291 #$HTTP["host"] =~ "^www\.(.*)" {
292 # url.redirect = ( "^/(.*)" => "http://%1/$1" )
296 # define a pattern for the host url finding
298 # %0 => domain name + tld
300 # %2 => domain name without tld
301 # %3 => subdomain 1 name
302 # %4 => subdomain 2 name
304 #evhost.path-pattern = "/srv/http/vhosts/%3/htdocs/"
307 #expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")
310 #ssi.extension = ( ".shtml" )
313 #rrdtool.binary = "/usr/bin/rrdtool"
314 #rrdtool.db-name = "/var/lib/lighttpd/lighttpd.rrd"
317 #setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" )
318 #setenv.add-response-header = ( "X-Secret-Message" => "42" )
320 ## for mod_trigger_b4_dl
321 # trigger-before-download.gdbm-filename = "/var/lib/lighttpd/trigger.db"
322 # trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
323 # trigger-before-download.trigger-url = "^/trigger/"
324 # trigger-before-download.download-url = "^/download/"
325 # trigger-before-download.deny-url = "http://127.0.0.1/index.html"
326 # trigger-before-download.trigger-timeout = 10
329 ## don't forget to add index.cml to server.indexfiles
330 # cml.extension = ".cml"
331 # cml.memcache-hosts = ( "127.0.0.1:11211" )
334 ## variable name without "." is auto prefixed by "var." and becomes "var.bar"
336 #var.mystring = "foo"
340 ## string concat, with integer cast as string, result: "www.foo1.com"
341 #server.name = "www." + mystring + var.bar + ".com"
343 #index-file.names = (foo + ".php") + index-file.names
344 #index-file.names += (foo + ".php")
347 #include /etc/lighttpd/lighttpd-inc.conf
348 ## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
349 #include "lighttpd-inc.conf"
352 #include_shell "echo var.a=1"
353 ## the above is same as: