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