Project

General

Profile

Software FAQs » lighttpd.conf

Scott Gerenser, 07/10/2012 09:14 AM

 
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_expire",
25
#                               "mod_fastcgi",
26
#                               "mod_proxy",
27
#                               "mod_simple_vhost",
28
#                               "mod_evhost",
29
#                               "mod_userdir",
30
                                "mod_cgi",
31
                                "mod_compress"
32
#                               "mod_ssi",
33
#                               "mod_usertrack",
34

    
35
#                               "mod_secdownload",
36
#                               "mod_rrdtool",
37
#				"mod_webdav",
38
#                               "mod_accesslog"
39
				 )
40

    
41
## a static document-root, for virtual-hosting take look at the
42
## server.virtual-* options
43
server.document-root        = "/var/www"
44

    
45
## where to send error-messages to
46
#server.errorlog             = "/www/logs/lighttpd.error.log"
47

    
48
# files to check for if .../ is requested
49
index-file.names            = ( "index.php", "index.html",
50
                                "index.htm", "default.htm" )
51

    
52
## set the event-handler (read the performance section in the manual)
53
# server.event-handler = "freebsd-kqueue" # needed on OS X
54

    
55
# mimetype mapping
56
mimetype.assign             = (
57
  ".pdf"          =>      "application/pdf",
58
  ".sig"          =>      "application/pgp-signature",
59
  ".spl"          =>      "application/futuresplash",
60
  ".class"        =>      "application/octet-stream",
61
  ".ps"           =>      "application/postscript",
62
  ".torrent"      =>      "application/x-bittorrent",
63
  ".dvi"          =>      "application/x-dvi",
64
  ".gz"           =>      "application/x-gzip",
65
  ".pac"          =>      "application/x-ns-proxy-autoconfig",
66
  ".swf"          =>      "application/x-shockwave-flash",
67
  ".tar.gz"       =>      "application/x-tgz",
68
  ".tgz"          =>      "application/x-tgz",
69
  ".tar"          =>      "application/x-tar",
70
  ".zip"          =>      "application/zip",
71
  ".mp3"          =>      "audio/mpeg",
72
  ".m3u"          =>      "audio/x-mpegurl",
73
  ".wma"          =>      "audio/x-ms-wma",
74
  ".wax"          =>      "audio/x-ms-wax",
75
  ".ogg"          =>      "application/ogg",
76
  ".wav"          =>      "audio/x-wav",
77
  ".gif"          =>      "image/gif",
78
  ".jpg"          =>      "image/jpeg",
79
  ".jpeg"         =>      "image/jpeg",
80
  ".png"          =>      "image/png",
81
  ".xbm"          =>      "image/x-xbitmap",
82
  ".xpm"          =>      "image/x-xpixmap",
83
  ".xwd"          =>      "image/x-xwindowdump",
84
  ".css"          =>      "text/css",
85
  ".html"         =>      "text/html",
86
  ".htm"          =>      "text/html",
87
  ".js"           =>      "text/javascript",
88
  ".asc"          =>      "text/plain",
89
  ".c"            =>      "text/plain",
90
  ".cpp"          =>      "text/plain",
91
  ".log"          =>      "text/plain",
92
  ".conf"         =>      "text/plain",
93
  ".text"         =>      "text/plain",
94
  ".txt"          =>      "text/plain",
95
  ".dtd"          =>      "text/xml",
96
  ".xml"          =>      "text/xml",
97
  ".mpeg"         =>      "video/mpeg",
98
  ".mpg"          =>      "video/mpeg",
99
  ".mov"          =>      "video/quicktime",
100
  ".qt"           =>      "video/quicktime",
101
  ".avi"          =>      "video/x-msvideo",
102
  ".asf"          =>      "video/x-ms-asf",
103
  ".asx"          =>      "video/x-ms-asf",
104
  ".wmv"          =>      "video/x-ms-wmv",
105
  ".bz2"          =>      "application/x-bzip",
106
  ".tbz"          =>      "application/x-bzip-compressed-tar",
107
  ".tar.bz2"      =>      "application/x-bzip-compressed-tar"
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          = "/www/logs/access.log"
120
#debug.log-request-handling = "enable"
121

    
122

    
123

    
124

    
125
## deny access the file-extensions
126
#
127
# ~    is for backupfiles from vi, emacs, joe, ...
128
# .inc is often used for code includes which should in general not be part
129
#      of the document-root
130
url.access-deny             = ( "~", ".inc" )
131

    
132
$HTTP["url"] =~ "\.pdf$" {
133
  server.range-requests = "disable"
134
}
135

    
136
##
137
# which extensions should not be handle via static-file transfer
138
#
139
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
140
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
141

    
142
######### Options that are good to be but not neccesary to be changed #######
143

    
144
## bind to port (default: 80)
145
server.port                = 8080
146

    
147
## bind to localhost (default: all interfaces)
148
#server.bind                = "grisu.home.kneschke.de"
149

    
150
## error-handler for status 404
151
#server.error-handler-404   = "/error-handler.html"
152
#server.error-handler-404   = "/error-handler.php"
153

    
154
## to help the rc.scripts
155
#server.pid-file            = "/var/run/lighttpd.pid"
156

    
157

    
158
###### virtual hosts
159
##
160
##  If you want name-based virtual hosting add the next three settings and load
161
##  mod_simple_vhost
162
##
163
## document-root =
164
##   virtual-server-root + virtual-server-default-host + virtual-server-docroot
165
## or
166
##   virtual-server-root + http-host + virtual-server-docroot
167
##
168
#simple-vhost.server-root   = "/home/weigon/wwwroot/servers/"
169
#simple-vhost.default-host  = "grisu.home.kneschke.de"
170
#simple-vhost.document-root = "/pages/"
171

    
172

    
173
##
174
## Format: <errorfile-prefix><status-code>.html
175
## -> ..../status-404.html for 'File not found'
176
#server.errorfile-prefix    = "/home/weigon/projects/lighttpd/doc/status-"
177

    
178
## virtual directory listings
179
#dir-listing.activate       = "enable"
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              = "/"
191

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

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

    
198
#### compress module
199
compress.cache-dir         = "/tmp/lighttpd/cache/compress/"
200
compress.filetype          = ("text/plain", "text/html","text/javascript","text/css","image/png","text/php")
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

    
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 -n -c /usr/share/matrix-gui-2.0/php.ini"
223
#                                 )
224
#                               )
225
#                            )
226

    
227
#### CGI module
228
cgi.assign                 = ( ".php"  => "/usr/bin/php-cgi")
229
#cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
230
#                               ".cgi" => "/usr/bin/perl" )
231
#
232

    
233
#### SSL engine
234
#ssl.engine                 = "enable"
235
#ssl.pemfile                = "server.pem"
236

    
237
#### status module
238
#status.status-url          = "/server-status"
239
#status.config-url          = "/server-config"
240

    
241
#### auth module
242
## read authentication.txt for more info
243
#auth.backend               = "plain"
244
#auth.backend.plain.userfile = "lighttpd.user"
245
#auth.backend.plain.groupfile = "lighttpd.group"
246

    
247
#auth.backend.ldap.hostname = "localhost"
248
#auth.backend.ldap.base-dn  = "dc=my-domain,dc=com"
249
#auth.backend.ldap.filter   = "(uid=$)"
250

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

    
265
#### url handling modules (rewrite, redirect, access)
266
#url.rewrite                = ( "^/$"             => "/server-status" )
267
#url.redirect               = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )
268

    
269
#### both rewrite/redirect support back reference to regex conditional using %n
270
#$HTTP["host"] =~ "^www\.(.*)" {
271
#  url.redirect            = ( "^/(.*)" => "http://%1/$1" )
272
#}
273

    
274
#
275
# define a pattern for the host url finding
276
# %% => % sign
277
# %0 => domain name + tld
278
# %1 => tld
279
# %2 => domain name without tld
280
# %3 => subdomain 1 name
281
# %4 => subdomain 2 name
282
#
283
#evhost.path-pattern        = "/home/storage/dev/www/%3/htdocs/"
284

    
285
#### expire module
286
#expire.url                 = ( "/images/" => "access 2 hours", "/css/" => "access plus 1 seconds 2 minutes")
287
$HTTP["url"] =~ "\.(jpg|gif|png)$" { expire.url = ( "" => "access 3 years" ) }
288

    
289
#### ssi
290
#ssi.extension              = ( ".shtml" )
291

    
292
#### rrdtool
293
#rrdtool.binary             = "/usr/bin/rrdtool"
294
#rrdtool.db-name            = "/var/www/lighttpd.rrd"
295

    
296
#### setenv
297
#setenv.add-request-header  = ( "TRAV_ENV" => "mysql://user@host/db" )
298
#setenv.add-response-header = ( "X-Secret-Message" => "42" )
299

    
300
## for mod_trigger_b4_dl
301
# trigger-before-download.gdbm-filename = "/home/weigon/testbase/trigger.db"
302
# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
303
# trigger-before-download.trigger-url = "^/trigger/"
304
# trigger-before-download.download-url = "^/download/"
305
# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
306
# trigger-before-download.trigger-timeout = 10
307

    
308
## for mod_cml
309
## don't forget to add index.cml to server.indexfiles
310
# cml.extension               = ".cml"
311
# cml.memcache-hosts          = ( "127.0.0.1:11211" )
312

    
313
#### variable usage:
314
## variable name without "." is auto prefixed by "var." and becomes "var.bar"
315
#bar = 1
316
#var.mystring = "foo"
317

    
318
## integer add
319
#bar += 1
320
## string concat, with integer cast as string, result: "www.foo1.com"
321
#server.name = "www." + mystring + var.bar + ".com"
322
## array merge
323
#index-file.names = (foo + ".php") + index-file.names
324
#index-file.names += (foo + ".php")
325

    
326
#### include
327
#include /etc/lighttpd/lighttpd-inc.conf
328
## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
329
#include "lighttpd-inc.conf"
330

    
331
#### include_shell
332
#include_shell "echo var.a=1"
333
## the above is same as:
334
#var.a=1
335

    
336

    
337
###Franklin
338
etag.use-inode = "enable"
339
etag.use-mtime = "enable"
340
etag.use-size = "enable"
341
static-file.etags = "enable"
(3-3/4) Go to top
Add picture from clipboard (Maximum size: 1 GB)