Project

General

Profile

lighttpd.conf

config of machine 1 - DeSnajpa, 2007-08-01 20:02

 
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        = "/home/srv/www/root/null.mastahizm.pl/"
41

    
42
## where to send error-messages to
43
server.errorlog             = "/home/srv/www/error.log"
44

    
45
# files to check for if .../ is requested
46
index-file.names            = ( "index.php", "index.html",
47
                                "index.htm", "default.htm", "index.rhtml" )
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
  ".jpg"          =>      "image/jpeg",
76
  ".jpeg"         =>      "image/jpeg",
77
  ".png"          =>      "image/png",
78
  ".xbm"          =>      "image/x-xbitmap",
79
  ".xpm"          =>      "image/x-xpixmap",
80
  ".xwd"          =>      "image/x-xwindowdump",
81
  ".css"          =>      "text/css",
82
  ".html"         =>      "text/html",
83
  ".htm"          =>      "text/html",
84
  ".js"           =>      "text/javascript",
85
  ".asc"          =>      "text/plain",
86
  ".c"            =>      "text/plain",
87
  ".cpp"          =>      "text/plain",
88
  ".log"          =>      "text/plain",
89
  ".conf"         =>      "text/plain",
90
  ".text"         =>      "text/plain",
91
  ".txt"          =>      "text/plain",
92
  ".dtd"          =>      "text/xml",
93
  ".xml"          =>      "text/xml",
94
  ".mpeg"         =>      "video/mpeg",
95
  ".mpg"          =>      "video/mpeg",
96
  ".mov"          =>      "video/quicktime",
97
  ".qt"           =>      "video/quicktime",
98
  ".avi"          =>      "video/x-msvideo",
99
  ".asf"          =>      "video/x-ms-asf",
100
  ".asx"          =>      "video/x-ms-asf",
101
  ".wmv"          =>      "video/x-ms-wmv",
102
  ".bz2"          =>      "application/x-bzip",
103
  ".tbz"          =>      "application/x-bzip-compressed-tar",
104
  ".tar.bz2"      =>      "application/x-bzip-compressed-tar"
105
 )
106

    
107
# Use the "Content-Type" extended attribute to obtain mime type if possible
108
#mimetype.use-xattr        = "enable"
109

    
110

    
111
## send a different Server: header
112
## be nice and keep it at lighttpd
113
# server.tag                 = "lighttpd"
114

    
115
#### accesslog module
116
accesslog.filename          = "/home/srv/www/access.log"
117

    
118
## deny access the file-extensions
119
#
120
# ~    is for backupfiles from vi, emacs, joe, ...
121
# .inc is often used for code includes which should in general not be part
122
#      of the document-root
123
url.access-deny             = ( "~", ".inc" )
124

    
125
$HTTP["url"] =~ "\.pdf$" {
126
  server.range-requests = "disable"
127
}
128

    
129
##
130
# which extensions should not be handle via static-file transfer
131
#
132
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
133
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
134

    
135
######### Options that are good to be but not neccesary to be changed #######
136

    
137
## bind to port (default: 80)
138
server.port                = 80
139

    
140
## bind to localhost (default: all interfaces)
141
#server.bind                = "grisu.home.kneschke.de"
142

    
143
## error-handler for status 404
144
#server.error-handler-404   = "/error-handler.html"
145
#server.error-handler-404   = "/error-handler.php"
146

    
147
## to help the rc.scripts
148
#server.pid-file            = "/var/run/lighttpd.pid"
149

    
150

    
151
###### virtual hosts
152
##
153
##  If you want name-based virtual hosting add the next three settings and load
154
##  mod_simple_vhost
155
##
156
## document-root =
157
##   virtual-server-root + virtual-server-default-host + virtual-server-docroot
158
## or
159
##   virtual-server-root + http-host + virtual-server-docroot
160
##
161
simple-vhost.server-root   = "/home/srv/www/root/"
162
simple-vhost.default-host  = "null.mastahizm.pl"
163
simple-vhost.document-root = "/"
164

    
165
##
166
## Format: <errorfile-prefix><status-code>.html
167
## -> ..../status-404.html for 'File not found'
168
#server.errorfile-prefix    = "/home/weigon/projects/lighttpd/doc/status-"
169

    
170
## virtual directory listings
171
dir-listing.activate       = "enable"
172

    
173
## enable debugging
174
#debug.log-request-header   = "enable"
175
#debug.log-response-header  = "enable"
176
#debug.log-request-handling = "enable"
177
#debug.log-file-not-found   = "enable"
178

    
179
### only root can use these options
180
#
181
# chroot() to directory (default: no chroot() )
182
#server.chroot              = "/"
183

    
184
## change uid to <uid> (default: don't care)
185
server.username            = "www"
186

    
187
## change uid to <uid> (default: don't care)
188
server.groupname           = "tomasz"
189

    
190
#### compress module
191
compress.cache-dir         = "/home/srv/www/tmp/"
192
compress.filetype          = ("text/plain", "text/html")
193

    
194
#### proxy module
195
## read proxy.txt for more info
196
#proxy.server               = ( ".php" =>
197
#                               ( "localhost" =>
198
#                                 (
199
#                                   "host" => "192.168.0.101",
200
#                                   "port" => 80
201
#                                 )
202
#                               )
203
#                             )
204

    
205

    
206
$HTTP["host"] == "trac.mastahizm.pl" {
207
  server.document-root="/home/srv/repo/www-trac"
208
  proxy.server = ( "/" => (
209
    "localhost" => ( "host" => "127.0.0.1", "port" => 8000)
210
  ) )
211
}
212

    
213
$HTTP["host"] =~ "primary.mastahizm.pl|(.*)primary.mastahizm.pl" {
214
  proxy.server = ( "/" => (
215
    "localhost" => ( "host" => "172.16.3.1", "port" => 80)
216
  ) )
217
}
218

    
219

    
220

    
221
#### fastcgi module
222
## read fastcgi.txt for more info
223
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
224
fastcgi.server             = ( ".php" =>
225
                               ( "localhost" =>
226
                                 (
227
                                   "socket" => "/tmp/php-fastcgi.socket",
228
                                   "bin-path" => "/home/srv/www/php/bin/php-cgi -c /home/srv/www/php/php.ini"
229
                                 )
230
                               )
231
                            )
232

    
233
#### CGI module
234
cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
235
                               ".cgi" => "/usr/bin/perl" ,
236
			       ".rhtml" => "/usr/bin/eruby")
237
#
238

    
239
#### SSL engine
240
$SERVER["socket"] == ":443" {
241
  ssl.engine                 = "enable"
242
  ssl.pemfile                = "/home/srv/www/lig/server.pem"
243
}
244
else $SERVER["socket"] == ":81" {
245
}
246
else $HTTP["host"] =~ "(.*).onion" {
247
}
248
else $HTTP["host"] =~ "(.*)" {
249
  url.redirect = ( "^/(.*)" => "https://%1/$1" )
250
}
251

    
252
#### status module
253
#status.status-url          = "/server-status"
254
#status.config-url          = "/server-config"
255

    
256
#### auth module
257
## read authentication.txt for more info
258
#auth.backend               = "plain"
259
#auth.backend.plain.userfile = "lighttpd.user"
260
#auth.backend.plain.groupfile = "lighttpd.group"
261

    
262
#auth.backend.ldap.hostname = "localhost"
263
#auth.backend.ldap.base-dn  = "dc=my-domain,dc=com"
264
#auth.backend.ldap.filter   = "(uid=$)"
265

    
266
#auth.require               = ( "/server-status" =>
267
#                               (
268
#                                 "method"  => "digest",
269
#                                 "realm"   => "download archiv",
270
#                                 "require" => "user=jan"
271
#                               ),
272
#                               "/server-config" =>
273
#                               (
274
#                                 "method"  => "digest",
275
#                                 "realm"   => "download archiv",
276
#                                 "require" => "valid-user"
277
#                               )
278
#                             )
279

    
280
#### url handling modules (rewrite, redirect, access)
281

    
282
$HTTP["host"] == "mastahizm.pl" {
283

    
284
url.rewrite-once = (                                                                                                   
285
                    "^(/|index.php)?$" => "/doku.php",                                                                     
286
                    "^/lib/(.*)/?$" => "/lib/$1",
287
                    "^/_media/(.*)?\?(.*)$" => "/lib/exe/fetch.php?media=$1&$2",
288
                    "^/_media/(.*)$" => "/lib/exe/fetch.php?media=$1",
289
                    "^/_detail/(.*)?\?(.*)$" => "/lib/exe/detail.php?media=$1&$2",
290
                    "^/_detail/(.*)?$" => "/lib/exe/detail.php?media=$1",
291
                    "^/_export/([^/]+)/(.*)$" => "/doku.php?do=export_$1&id=$2",
292
                    "^/(?!doku.php|feed.php|robots.txt|sitemap.xml.gz)(.*)\?(.*)/?$" => "/doku.php?id=$1&$2",
293
                    "^/(?!doku.php|feed.php|robots.txt|sitemap.xml.gz|lib|_media|_detail|_export)(.*)/?$" => "/doku.php?id=$1",
294
                  )
295
}
296
#url.rewrite                = ( "^/$"             => "/server-status" )
297
#url.redirect               = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )
298
#### both rewrite/redirect support back reference to regex conditional using %n
299
#$HTTP["host"] =~ "^www\.(.*)" {
300
#  url.redirect            = ( "^/(.*)" => "http://%1/$1" )
301
#}
302

    
303
#
304
# define a pattern for the host url finding
305
# %% => % sign
306
# %0 => domain name + tld
307
# %1 => tld
308
# %2 => domain name without tld
309
# %3 => subdomain 1 name
310
# %4 => subdomain 2 name
311
#
312
#evhost.path-pattern        = "/home/srv/www/root/%0/"
313

    
314
#### expire module
315
#expire.url                 = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")
316

    
317
#### ssi
318
#ssi.extension              = ( ".shtml" )
319

    
320
#### rrdtool
321
#rrdtool.binary             = "/usr/bin/rrdtool"
322
#rrdtool.db-name            = "/var/www/lighttpd.rrd"
323

    
324
#### setenv
325
#setenv.add-request-header  = ( "TRAV_ENV" => "mysql://user@host/db" )
326
#setenv.add-response-header = ( "X-Secret-Message" => "42" )
327

    
328
## for mod_trigger_b4_dl
329
# trigger-before-download.gdbm-filename = "/home/weigon/testbase/trigger.db"
330
# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
331
# trigger-before-download.trigger-url = "^/trigger/"
332
# trigger-before-download.download-url = "^/download/"
333
# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
334
# trigger-before-download.trigger-timeout = 10
335

    
336
## for mod_cml
337
## don't forget to add index.cml to server.indexfiles
338
# cml.extension               = ".cml"
339
# cml.memcache-hosts          = ( "127.0.0.1:11211" )
340

    
341
#### variable usage:
342
## variable name without "." is auto prefixed by "var." and becomes "var.bar"
343
#bar = 1
344
#var.mystring = "foo"
345

    
346
## integer add
347
#bar += 1
348
## string concat, with integer cast as string, result: "www.foo1.com"
349
#server.name = "www." + mystring + var.bar + ".com"
350
## array merge
351
#index-file.names = (foo + ".php") + index-file.names
352
#index-file.names += (foo + ".php")
353

    
354
#### include
355
#include /etc/lighttpd/lighttpd-inc.conf
356
## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
357
#include "lighttpd-inc.conf"
358

    
359
#### include_shell
360
#include_shell "echo var.a=1"
361
## the above is same as:
362
#var.a=1
363
#
364
$HTTP["host"] == "code.mastahizm.pl" {
365
  proxy.server = (
366
    "/svn/brzuch" => (("host"=>"127.0.0.1", "port" => 10080)),
367
    "/svn/jlibxmpp" => (("host"=>"127.0.0.1", "port" => 10080))
368

    
369
  )
370
}
371
$HTTP["host"] == "mastahizm.pl" {
372
} else $HTTP["host"] == "mnt.szczecin.pl" {
373
} else $HTTP["useragent"] =~ "bot" {
374
    url.access-deny=("")
375
}
376