Project

General

Profile

Bug #2150 » lighttpd.conf

laforge, 2010-01-10 20:27

 
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_ssi",
16
#                               "mod_rewrite",
17
#                               "mod_redirect",
18
#                               "mod_alias",
19
                                "mod_access",
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_usertrack",
32
#                               "mod_expire",
33
#                               "mod_secdownload",
34
#                               "mod_rrdtool",
35
                                "mod_accesslog" )
36

    
37
## A static document-root. For virtual hosting take a look at the
38
## mod_simple_vhost module.
39
server.document-root        = "/var/www/lighttpd/"
40

    
41
## where to send error-messages to
42
server.errorlog             = "/var/log/lighttpd/error.log"
43

    
44
# files to check for if .../ is requested
45
index-file.names            = ( "index.php", "index.html",
46
                                "index.htm", "default.htm" )
47

    
48
## set the event-handler (read the performance section in the manual)
49
# server.event-handler = "freebsd-kqueue" # needed on OS X
50

    
51
# mimetype mapping
52
mimetype.assign             = (
53
  ".rpm"          =>      "application/x-rpm",
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
$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_fastcgi 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                = "127.0.0.1"
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   = "/srv/www/vhosts/"
165
#simple-vhost.default-host  = "www.example.org"
166
#simple-vhost.document-root = "/htdocs/"
167

    
168

    
169
##
170
## Format: <errorfile-prefix><status-code>.html
171
## -> ..../status-404.html for 'File not found'
172
#server.errorfile-prefix    = "/usr/share/lighttpd/errors/status-"
173
#server.errorfile-prefix    = "/srv/www/errors/status-"
174

    
175
## virtual directory listings
176
#dir-listing.activate       = "enable"
177
## select encoding for directory listings
178
#dir-listing.encoding        = "utf-8"
179

    
180
## enable debugging
181
#debug.log-request-header   = "enable"
182
#debug.log-response-header  = "enable"
183
#debug.log-request-handling = "enable"
184
#debug.log-file-not-found   = "enable"
185

    
186
### only root can use these options
187
#
188
# chroot() to directory (default: no chroot() )
189
#server.chroot              = "/"
190

    
191
## change uid to <uid> (default: don't care)
192
server.username            = "lighttpd"
193

    
194
## change uid to <uid> (default: don't care)
195
server.groupname           = "lighttpd"
196

    
197
#### compress module
198
#compress.cache-dir         = "/var/cache/lighttpd/compress/"
199
#compress.filetype          = ("text/plain", "text/html")
200

    
201
#### proxy module
202
## read proxy.txt for more info
203
#proxy.server               = ( ".php" =>
204
#                               ( "localhost" =>
205
#                                 (
206
#                                   "host" => "192.168.0.101",
207
#                                   "port" => 80
208
#                                 )
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             = ( ".php" =>
217
#                               ( "localhost" =>
218
#                                 (
219
#                                   "socket" => "/var/run/lighttpd/php-fastcgi.socket",
220
#                                   "bin-path" => "/usr/bin/php-cgi"
221
#                                 )
222
#                               )
223
#                            )
224

    
225
#### CGI module
226
#cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
227
#                               ".cgi" => "/usr/bin/perl" )
228
#
229

    
230
#### SSL engine
231
#ssl.engine                 = "enable"
232
#ssl.pemfile                = "/etc/ssl/private/lighttpd.pem"
233

    
234
#### status module
235
status.status-url          = "/server-status"
236
status.config-url          = "/server-config"
237

    
238
#### auth module
239
## read authentication.txt for more info
240
#auth.backend               = "plain"
241
#auth.backend.plain.userfile = "lighttpd.user"
242
#auth.backend.plain.groupfile = "lighttpd.group"
243

    
244
#auth.backend.ldap.hostname = "localhost"
245
#auth.backend.ldap.base-dn  = "dc=my-domain,dc=com"
246
#auth.backend.ldap.filter   = "(uid=$)"
247

    
248
#auth.require               = ( "/server-status" =>
249
#                               (
250
#                                 "method"  => "digest",
251
#                                 "realm"   => "download archiv",
252
#                                 "require" => "user=jan"
253
#                               ),
254
#                               "/server-config" =>
255
#                               (
256
#                                 "method"  => "digest",
257
#                                 "realm"   => "download archiv",
258
#                                 "require" => "valid-user"
259
#                               )
260
#                             )
261

    
262
#### url handling modules (rewrite, redirect, access)
263
#url.rewrite                = ( "^/$"             => "/server-status" )
264
#url.redirect               = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )
265
#### both rewrite/redirect support back reference to regex conditional using %n
266
#$HTTP["host"] =~ "^www\.(.*)" {
267
#  url.redirect            = ( "^/(.*)" => "http://%1/$1" )
268
#}
269

    
270
#
271
# define a pattern for the host url finding
272
# %% => % sign
273
# %0 => domain name + tld
274
# %1 => tld
275
# %2 => domain name without tld
276
# %3 => subdomain 1 name
277
# %4 => subdomain 2 name
278
#
279
#evhost.path-pattern        = "/srv/www/vhosts/%3/htdocs/"
280

    
281
#### expire module
282
#expire.url                 = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")
283

    
284
#### ssi
285
ssi.extension              = ( ".shtml" )
286

    
287
#### rrdtool
288
#rrdtool.binary             = "/usr/bin/rrdtool"
289
#rrdtool.db-name            = "/var/lib/lighttpd/lighttpd.rrd"
290

    
291
#### setenv
292
#setenv.add-request-header  = ( "TRAV_ENV" => "mysql://user@host/db" )
293
#setenv.add-response-header = ( "X-Secret-Message" => "42" )
294

    
295
setenv.add-environment = ( "KIWI_ENV" => "PRODUCTION" )
296

    
297
## for mod_trigger_b4_dl
298
# trigger-before-download.gdbm-filename = "/var/lib/lighttpd/trigger.db"
299
# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
300
# trigger-before-download.trigger-url = "^/trigger/"
301
# trigger-before-download.download-url = "^/download/"
302
# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
303
# trigger-before-download.trigger-timeout = 10
304

    
305
#### variable usage:
306
## variable name without "." is auto prefixed by "var." and becomes "var.bar"
307
#bar = 1
308
#var.mystring = "foo"
309

    
310
## integer add
311
#bar += 1
312
## string concat, with integer cast as string, result: "www.foo1.com"
313
#server.name = "www." + mystring + var.bar + ".com"
314
## array merge
315
#index-file.names = (foo + ".php") + index-file.names
316
#index-file.names += (foo + ".php")
317

    
318
#### include
319
#include /etc/lighttpd/lighttpd-inc.conf
320
## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
321
#include "lighttpd-inc.conf"
322

    
323
#### include_shell
324
#include_shell "echo var.a=1"
325
## the above is same as:
326
#var.a=1
327

    
328
## include configuration snippets, usually provided by packages
329
include_shell "find /etc/lighttpd/conf.d -maxdepth 1 -name '*.conf' -exec cat {} \;"
330

    
(1-1/3)