Project

General

Profile

Feature #1014 » lighttpd.conf

Modified default configuration file - Hammel, 24 Sep 2023 17:10

 
1
#######################################################################
2
##
3
## /etc/lighttpd/lighttpd.conf
4
##
5
## check /etc/lighttpd/conf.d/*.conf for the configuration of modules.
6
##
7
#######################################################################
8

    
9
#######################################################################
10
##
11
## Some Variable definition which will make chrooting easier.
12
##
13
## if you add a variable here. Add the corresponding variable in the
14
## chroot example as well.
15
##
16
var.log_root    = "/var/log"
17
# var.server_root = "/var/www"
18
var.server_root = "/home/httpd/monkey"
19
# var.state_dir   = "/run"
20
var.state_dir   = "/var/run"
21
var.home_dir    = "/var/lib/lighttpd"
22
var.conf_dir    = "/etc/lighttpd"
23

    
24
## 
25
## run the server chrooted.
26
## 
27
## This requires root permissions during startup.
28
##
29
## If you run chroot'ed, set the variables to directories relative to
30
## the chroot dir.
31
##
32
## example chroot configuration:
33
## 
34
#var.log_root    = "/logs"
35
#var.server_root = "/"
36
#var.state_dir   = "/run"
37
#var.home_dir    = "/lib/lighttpd"
38
#var.vhosts_dir  = "/vhosts"
39
#var.conf_dir    = "/etc"
40
#
41
#server.chroot   = "/srv/www"
42

    
43
##
44
## Some additional variables to make the configuration easier
45
##
46

    
47
##
48
## Base directory for all virtual hosts
49
##
50
## used in:
51
## conf.d/evhost.conf
52
## conf.d/simple_vhost.conf
53
## vhosts.d/vhosts.template
54
##
55
# var.vhosts_dir  = server_root + "/vhosts"
56

    
57
##
58
## Cache for mod_deflate
59
##
60
## used in:
61
## conf.d/deflate.conf
62
##
63
var.cache_dir   = "/var/cache/lighttpd"
64

    
65
##
66
## Base directory for sockets.
67
##
68
## used in:
69
## conf.d/fastcgi.conf
70
## conf.d/scgi.conf
71
##
72
var.socket_dir  = home_dir + "/sockets"
73

    
74
##
75
#######################################################################
76

    
77
#######################################################################
78
##
79
## Load the modules.
80
include conf_dir + "/modules.conf"
81

    
82
fastcgi.server = ( ".php" => ((
83
                     "bin-path" => "/usr/bin/php-cgi",
84
                     "socket" => "/tmp/php.socket"
85
                 )))
86

    
87
##
88
#######################################################################
89

    
90
#######################################################################
91
##
92
##  Basic Configuration
93
## ---------------------
94
##
95
# server.port = 80
96
server.port = 2001
97

    
98
##
99
## bind to a specific IP
100
## (default: "*" for all local IPv4 interfaces)
101
##
102
#server.bind = "localhost"
103

    
104
##
105
## Run as a different username/groupname.
106
## This requires root permissions during startup. 
107
##
108
# server.username  = "www-data"
109
# server.groupname = "www-data"
110
server.username  = "nobody"
111
server.groupname = "nobody"
112

    
113
##
114
## Enable lighttpd to serve requests on sockets received from systemd
115
## https://www.freedesktop.org/software/systemd/man/systemd.socket.html
116
##
117
#server.systemd-socket-activation = "enable"
118

    
119
## 
120
## enable core files.
121
##
122
#server.core-files = "disable"
123

    
124
##
125
## Document root
126
##
127
server.document-root = server_root
128

    
129
##
130
## The value for the "Server:" response field.
131
##
132
## It would be nice to keep it at "lighttpd".
133
##
134
#server.tag = "lighttpd"
135
server.tag = "PiBox"
136

    
137
##
138
## store a pid file
139
##
140
server.pid-file = state_dir + "/lighttpd.pid"
141

    
142
##
143
#######################################################################
144

    
145
#######################################################################
146
##
147
##  Logging Options
148
## ------------------
149
##
150
## all logging options can be overwritten per vhost.
151
##
152
## Path to the error log file
153
##
154
server.errorlog             = log_root + "/lighttpd-error.log"
155

    
156
##
157
## If you want to log to syslog you have to unset the 
158
## server.errorlog setting and uncomment the next line.
159
##
160
#server.errorlog-use-syslog = "enable"
161

    
162
##
163
## Access log config
164
## 
165
# include conf_dir + "/conf.d/access_log.conf"
166

    
167
##
168
## The debug options are moved into their own file.
169
## see conf.d/debug.conf for various options for request debugging.
170
##
171
include conf_dir + "/conf.d/debug.conf"
172

    
173
##
174
#######################################################################
175

    
176
#######################################################################
177
##
178
##  Tuning/Performance
179
## --------------------
180
##
181
## corresponding documentation:
182
## https://wiki.lighttpd.net/Docs_Performance
183
##
184
## set the event-handler (read the performance section in the manual)
185
##
186
## The recommended server.event-handler is chosen by default for each OS.
187
##
188
## epoll  (recommended on Linux)
189
## kqueue (recommended on *BSD and MacOS X)
190
## solaris-eventports (recommended on Solaris)
191
## poll   (recommended if none of above are available)
192
## select (*not* recommended)
193
##
194
#server.event-handler = "linux-sysepoll"
195

    
196
##
197
## The basic network interface for all platforms at the syscalls read()
198
## and write(). Every modern OS provides its own syscall to help network
199
## servers transfer files as fast as possible 
200
##
201
server.network-backend = "writev"
202

    
203
##
204
## As lighttpd is a single-threaded server, its main resource limit is
205
## the number of file descriptors, which is set to 1024 by default (on
206
## most systems).
207
##
208
## If you are running a high-traffic site you might want to increase this
209
## limit by setting server.max-fds.
210
##
211
## Changing this setting requires root permissions on startup. see
212
## server.username/server.groupname.
213
##
214
## By default lighttpd would not change the operation system default.
215
## But setting it to 16384 is a better default for busy servers.
216
##
217
## With SELinux enabled, this is denied by default and needs to be allowed
218
## by running the following once: setsebool -P httpd_setrlimit on
219
##
220
# server.max-fds = 16384
221

    
222
##
223
## listen-backlog is the size of the listen() backlog queue requested when
224
## the lighttpd server ask the kernel to listen() on the provided network
225
## address.  Clients attempting to connect() to the server enter the listen()
226
## backlog queue and wait for the lighttpd server to accept() the connection.
227
##
228
## The out-of-box default on many operating systems is 128 and is identified
229
## as SOMAXCONN.  This can be tuned on many operating systems.  (On Linux,
230
## cat /proc/sys/net/core/somaxconn)  Requesting a size larger than operating
231
## system limit will be silently reduced to the limit by the operating system.
232
##
233
## When there are too many connection attempts waiting for the server to
234
## accept() new connections, the listen backlog queue fills and the kernel
235
## rejects additional connection attempts.  This can be useful as an
236
## indication to an upstream load balancer that the server is busy, and
237
## possibly overloaded.  In that case, configure a smaller limit for
238
## server.listen-backlog.  On the other hand, configure a larger limit to be
239
## able to handle bursts of new connections, but only do so up to an amount
240
## that the server can keep up with responding in a reasonable amount of
241
## time.  Otherwise, clients may abandon the connection attempts and the
242
## server will waste resources servicing abandoned connections.
243
##
244
## It is best to leave this setting at its default unless you have modelled
245
## your traffic and tested that changing this benefits your traffic patterns.
246
##
247
## Default: 1024
248
##
249
#server.listen-backlog = 128
250

    
251
##
252
## Stat() call caching.
253
##
254
## lighttpd can utilize FAM/Gamin to cache stat call.
255
##
256
## possible values are:
257
## disable, simple, inotify, kqueue, or fam.
258
##
259
#server.stat-cache-engine = "simple"
260

    
261
##
262
## Fine tuning for the request handling
263
##
264
## max-connections == max-fds/3)
265
## (other file handles are used for fastcgi/files)
266
##
267
#server.max-connections = 1024
268

    
269
##
270
## How many seconds to keep a keep-alive connection open,
271
## until we consider it idle. 
272
##
273
## Default: 5
274
##
275
#server.max-keep-alive-idle = 5
276

    
277
##
278
## How many keep-alive requests until closing the connection.
279
##
280
## Default: 16
281
##
282
#server.max-keep-alive-requests = 16
283

    
284
##
285
## Maximum size of a request in kilobytes.
286
## By default it is unlimited (0).
287
##
288
## Uploads to your server cant be larger than this value.
289
##
290
#server.max-request-size = 0
291

    
292
##
293
## Time to read from a socket before we consider it idle.
294
##
295
## Default: 60
296
##
297
#server.max-read-idle = 60
298

    
299
##
300
## Time to write to a socket before we consider it idle.
301
##
302
## Default: 360
303
##
304
#server.max-write-idle = 360
305

    
306
##
307
##  Traffic Shaping 
308
## -----------------
309
##
310
## see /usr/share/doc/lighttpd/traffic-shaping.txt
311
##
312
## Values are in kilobyte per second.
313
##
314
## Keep in mind that a limit below 32kB/s might actually limit the
315
## traffic to 32kB/s. This is caused by the size of the TCP send
316
## buffer. 
317
##
318
## per server:
319
##
320
#server.kbytes-per-second = 128
321

    
322
##
323
## per connection:
324
##
325
#connection.kbytes-per-second = 32
326

    
327
##
328
#######################################################################
329

    
330
#######################################################################
331
##
332
##  Filename/File handling
333
## ------------------------
334

    
335
##
336
## files to check for if .../ is requested
337
## index-file.names            = ( "index.php", "index.rb", "index.html",
338
##                                 "index.htm", "default.htm" )
339
##
340
index-file.names += (
341
  "index.xhtml", "index.html", "index.htm", "default.htm", "index.php"
342
)
343

    
344
##
345
## deny access the file-extensions
346
##
347
## ~    is for backupfiles from vi, emacs, joe, ...
348
## .inc is often used for code includes which should in general not be part
349
##      of the document-root
350
url.access-deny             = ( "~", ".inc" )
351

    
352
##
353
## disable range requests for pdf files
354
## workaround for a bug in the Acrobat Reader plugin.
355
## (ancient; should no longer be needed)
356
##
357
#$HTTP["url"] =~ "\.pdf$" {
358
#  server.range-requests = "disable"
359
#}
360

    
361
##
362
## url handling modules (rewrite, redirect)
363
##
364
#url.rewrite                = ( "^/$"             => "/server-status" )
365
#url.redirect               = ( "^/wishlist/(.+)" => "http://www.example.com/$1" )
366

    
367
##
368
## both rewrite/redirect support back reference to regex conditional using %n
369
##
370
#$HTTP["host"] =~ "^www\.(.*)" {
371
#  url.redirect            = ( "^/(.*)" => "http://%1/$1" )
372
#}
373

    
374
##
375
## which extensions should not be handle via static-file transfer
376
##
377
## .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
378
##
379
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )
380

    
381
##
382
## error-handler for all status 400-599
383
##
384
#server.error-handler       = "/error-handler.html"
385
#server.error-handler       = "/error-handler.php"
386

    
387
##
388
## error-handler for status 404
389
##
390
#server.error-handler-404   = "/error-handler.html"
391
#server.error-handler-404   = "/error-handler.php"
392

    
393
##
394
## Format: <errorfile-prefix><status-code>.html
395
## -> ..../status-404.html for 'File not found'
396
##
397
#server.errorfile-prefix    = server_root + "/htdocs/errors/status-"
398

    
399
##
400
## mimetype mapping
401
##
402
include conf_dir + "/conf.d/mime.conf"
403

    
404
##
405
## directory listing configuration
406
##
407
# include conf_dir + "/conf.d/dirlisting.conf"
408

    
409
##
410
## Should lighttpd follow symlinks?
411
## default: "enable"
412
#server.follow-symlink = "enable"
413

    
414
##
415
## force all filenames to be lowercase?
416
##
417
#server.force-lowercase-filenames = "disable"
418

    
419
##
420
## defaults to /var/tmp as we assume it is a local harddisk
421
## default: "/var/tmp"
422
#server.upload-dirs = ( "/var/tmp" )
423

    
424
##
425
#######################################################################
426

    
427
#######################################################################
428
##
429
##  SSL Support
430
## ------------- 
431
##
432
## https://wiki.lighttpd.net/Docs_SSL
433
#
434
## To enable SSL for the whole server you have to provide a valid
435
## certificate and have to enable the SSL engine.::
436
##
437
##   server.modules += ( "mod_openssl" )
438
##
439
##   ssl.privkey = "/path/to/privkey.pem"
440
##   ssl.pemfile = "/path/to/fullchain.pem"
441
##   # ssl.pemfile should contain the sorted certificate chain, including
442
##   # intermediate certificates, as provided by the certificate issuer.
443
##   # If both privkey and cert are in same file, specify only ssl.pemfile.
444
##
445
##   # Check your cipher list with: openssl ciphers -v '...'
446
##   # (use single quotes with: openssl ciphers -v '...'
447
##   #  as your shell won't like ! in double quotes)
448
##   #ssl.cipher-list            = "HIGH"   # default
449
##
450
##   # (recommended to accept only TLSv1.2 and TLSv1.3)
451
##   #ssl.openssl.ssl-conf-cmd = ("MinProtocol" => "TLSv1.2")  # default
452
##
453
##   $SERVER["socket"] == "*:443" {
454
##     ssl.engine  = "enable"
455
##   }
456
##   $SERVER["socket"] == "[::]:443" {
457
##     ssl.engine  = "enable"
458
##   }
459
##
460
#######################################################################
461

    
462
#######################################################################
463
##
464
## custom includes like vhosts.
465
##
466
#include conf_dir + "/conf.d/config.conf"
467
#include conf_dir + "/vhosts.d/*.conf"
468
##
469
#######################################################################
470

    
(1-1/3)