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 aswell. 15## 16var.log_root = "/var/log" 17var.server_root = "/usr/share/matrix-gui-2.0" 18var.state_dir = "/var/run" 19var.home_dir = "/var/lib/lighttpd" 20var.conf_dir = "/etc/lighttpd" 21 22## 23## run the server chrooted. 24## 25## This requires root permissions during startup. 26## 27## If you run Chrooted set the the variables to directories relative to 28## the chroot dir. 29## 30## example chroot configuration: 31## 32#var.log_root = "/logs" 33#var.server_root = "/" 34#var.state_dir = "/run" 35#var.home_dir = "/lib/lighttpd" 36#var.vhosts_dir = "/vhosts" 37#var.conf_dir = "/etc" 38# 39#server.chroot = "/srv/www" 40 41## 42## Some additional variables to make the configuration easier 43## 44 45## 46## Base directory for all virtual hosts 47## 48## used in: 49## conf.d/evhost.conf 50## conf.d/simple_vhost.conf 51## vhosts.d/vhosts.template 52## 53var.vhosts_dir = server_root + "/vhosts" 54 55## 56## Cache for mod_deflate 57## 58## used in: 59## conf.d/deflate.conf 60## 61var.cache_dir = "/var/cache/lighttpd" 62 63## 64## Base directory for sockets. 65## 66## used in: 67## conf.d/fastcgi.conf 68## conf.d/scgi.conf 69## 70var.socket_dir = home_dir + "/sockets" 71 72## 73####################################################################### 74 75####################################################################### 76## 77## Load the modules. 78include conf_dir + "/modules.conf" 79 80## 81####################################################################### 82 83####################################################################### 84## 85## Basic Configuration 86## --------------------- 87## 88server.port = 80 89 90## 91## Use IPv6? 92## 93# server.use-ipv6 = "enable" 94 95## 96## bind to a specific IP 97## 98#server.bind = "localhost" 99 100## 101## Run as a different username/groupname. 102## This requires root permissions during startup. 103## 104#server.username = "www-data" 105#server.groupname = "www-data" 106 107## 108## Enable lighttpd to serve requests on sockets received from systemd 109## https://www.freedesktop.org/software/systemd/man/systemd.socket.html 110## 111#server.systemd-socket-activation = "enable" 112 113## 114## enable core files. 115## 116#server.core-files = "disable" 117 118## 119## Document root 120## 121server.document-root = server_root 122 123## 124## The value for the "Server:" response field. 125## 126## It would be nice to keep it at "lighttpd". 127## 128#server.tag = "lighttpd" 129 130## 131## store a pid file 132## 133server.pid-file = state_dir + "/lighttpd.pid" 134 135## 136####################################################################### 137 138####################################################################### 139## 140## Logging Options 141## ------------------ 142## 143## all logging options can be overwritten per vhost. 144## 145## Path to the error log file 146## 147server.errorlog = log_root + "/lighttpd-error.log" 148 149## 150## If you want to log to syslog you have to unset the 151## server.errorlog setting and uncomment the next line. 152## 153#server.errorlog-use-syslog = "enable" 154 155## 156## Access log config 157## 158include conf_dir + "/conf.d/access_log.conf" 159 160## 161## The debug options are moved into their own file. 162## see conf.d/debug.conf for various options for request debugging. 163## 164include conf_dir + "/conf.d/debug.conf" 165 166## 167####################################################################### 168 169####################################################################### 170## 171## Tuning/Performance 172## -------------------- 173## 174## corresponding documentation: 175## https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_Performance 176## 177## set the event-handler (read the performance section in the manual) 178## 179## The recommended server.event-handler is chosen for each OS, if available. 180## 181## epoll (recommended on Linux) 182## kqueue (recommended on *BSD and MacOS X) 183## solaris-devpoll (recommended on Solaris) 184## poll (recommended if none of above are available) 185## select (not recommended) 186## libev (not recommended) 187## 188server.event-handler = "linux-sysepoll" 189 190## 191## The basic network interface for all platforms at the syscalls read() 192## and write(). Every modern OS provides its own syscall to help network 193## servers transfer files as fast as possible 194## 195## sendfile - is recommended for small files. 196## writev - is recommended for sending many large files 197## 198server.network-backend = "writev" 199 200## 201## As lighttpd is a single-threaded server, its main resource limit is 202## the number of file descriptors, which is set to 1024 by default (on 203## most systems). 204## 205## If you are running a high-traffic site you might want to increase this 206## limit by setting server.max-fds. 207## 208## Changing this setting requires root permissions on startup. see 209## server.username/server.groupname. 210## 211## By default lighttpd would not change the operation system default. 212## But setting it to 2048 is a better default for busy servers. 213## 214server.max-fds = 2048 215 216## 217## listen-backlog is the size of the listen() backlog queue requested when 218## the lighttpd server ask the kernel to listen() on the provided network 219## address. Clients attempting to connect() to the server enter the listen() 220## backlog queue and wait for the lighttpd server to accept() the connection. 221## 222## The out-of-box default on many operating systems is 128 and is identified 223## as SOMAXCONN. This can be tuned on many operating systems. (On Linux, 224## cat /proc/sys/net/core/somaxconn) Requesting a size larger than operating 225## system limit will be silently reduced to the limit by the operating system. 226## 227## When there are too many connection attempts waiting for the server to 228## accept() new connections, the listen backlog queue fills and the kernel 229## rejects additional connection attempts. This can be useful as an 230## indication to an upstream load balancer that the server is busy, and 231## possibly overloaded. In that case, configure a smaller limit for 232## server.listen-backlog. On the other hand, configure a larger limit to be 233## able to handle bursts of new connections, but only do so up to an amount 234## that the server can keep up with responding in a reasonable amount of 235## time. Otherwise, clients may abandon the connection attempts and the 236## server will waste resources servicing abandoned connections. 237## 238## It is best to leave this setting at its default unless you have modelled 239## your traffic and tested that changing this benefits your traffic patterns. 240## 241## Default: 1024 242## 243#server.listen-backlog = 128 244 245## 246## Stat() call caching. 247## 248## lighttpd can utilize FAM/Gamin to cache stat call. 249## 250## possible values are: 251## disable, simple or fam. 252## 253server.stat-cache-engine = "simple" 254 255## 256## Fine tuning for the request handling 257## 258## max-connections == max-fds/2 (maybe /3) 259## means the other file handles are used for fastcgi/files 260## 261server.max-connections = 1024 262 263## 264## How many seconds to keep a keep-alive connection open, 265## until we consider it idle. 266## 267## Default: 5 268## 269#server.max-keep-alive-idle = 5 270 271## 272## How many keep-alive requests until closing the connection. 273## 274## Default: 16 275## 276#server.max-keep-alive-requests = 16 277 278## 279## Maximum size of a request in kilobytes. 280## By default it is unlimited (0). 281## 282## Uploads to your server cant be larger than this value. 283## 284#server.max-request-size = 0 285 286## 287## Time to read from a socket before we consider it idle. 288## 289## Default: 60 290## 291#server.max-read-idle = 60 292 293## 294## Time to write to a socket before we consider it idle. 295## 296## Default: 360 297## 298#server.max-write-idle = 360 299 300## 301## Traffic Shaping 302## ----------------- 303## 304## see /usr/share/doc/lighttpd/traffic-shaping.txt 305## 306## Values are in kilobyte per second. 307## 308## Keep in mind that a limit below 32kB/s might actually limit the 309## traffic to 32kB/s. This is caused by the size of the TCP send 310## buffer. 311## 312## per server: 313## 314#server.kbytes-per-second = 128 315 316## 317## per connection: 318## 319#connection.kbytes-per-second = 32 320 321## 322####################################################################### 323 324####################################################################### 325## 326## Filename/File handling 327## ------------------------ 328 329## 330## files to check for if .../ is requested 331## index-file.names = ( "index.php", "index.rb", "index.html", 332## "index.htm", "default.htm" ) 333## 334index-file.names += ( 335 "index.xhtml", "index.html", "index.htm", "default.htm", "index.php" 336) 337 338## 339## deny access the file-extensions 340## 341## ~ is for backupfiles from vi, emacs, joe, ... 342## .inc is often used for code includes which should in general not be part 343## of the document-root 344url.access-deny = ( "~", ".inc" ) 345 346## 347## disable range requests for pdf files 348## workaround for a bug in the Acrobat Reader plugin. 349## (ancient; should no longer be needed) 350## 351#$HTTP["url"] =~ "\.pdf$" { 352# server.range-requests = "disable" 353#} 354 355## 356## url handling modules (rewrite, redirect) 357## 358#url.rewrite = ( "^/$" => "/server-status" ) 359#url.redirect = ( "^/wishlist/(.+)" => "http://www.example.com/$1" ) 360 361## 362## both rewrite/redirect support back reference to regex conditional using %n 363## 364#$HTTP["host"] =~ "^www\.(.*)" { 365# url.redirect = ( "^/(.*)" => "http://%1/$1" ) 366#} 367 368## 369## which extensions should not be handle via static-file transfer 370## 371## .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi 372## 373static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" ) 374 375## 376## error-handler for all status 400-599 377## 378#server.error-handler = "/error-handler.html" 379#server.error-handler = "/error-handler.php" 380 381## 382## error-handler for status 404 383## 384#server.error-handler-404 = "/error-handler.html" 385#server.error-handler-404 = "/error-handler.php" 386 387## 388## Format: <errorfile-prefix><status-code>.html 389## -> ..../status-404.html for 'File not found' 390## 391#server.errorfile-prefix = "/srv/www/htdocs/errors/status-" 392 393## 394## mimetype mapping 395## 396include conf_dir + "/conf.d/mime.conf" 397 398## 399## directory listing configuration 400## 401include conf_dir + "/conf.d/dirlisting.conf" 402 403## 404## Should lighttpd follow symlinks? 405## default: "enable" 406server.follow-symlink = "enable" 407 408## 409## force all filenames to be lowercase? 410## 411#server.force-lowercase-filenames = "disable" 412 413## 414## defaults to /var/tmp as we assume it is a local harddisk 415## default: "/var/tmp" 416server.upload-dirs = ( "/var/tmp" ) 417 418## 419####################################################################### 420 421 422####################################################################### 423## 424## SSL Support 425## ------------- 426## 427## To enable SSL for the whole server you have to provide a valid 428## certificate and have to enable the SSL engine.:: 429## 430## ssl.engine = "enable" 431## ssl.pemfile = "/path/to/server.pem" 432## 433## $SERVER["socket"] == "10.0.0.1:443" { 434## ssl.engine = "enable" 435## ssl.pemfile = "/etc/ssl/private/www.example.com.pem" 436## 437## # Check your cipher list with: openssl ciphers -v '...' 438## # (use single quotes as your shell won't like ! in double quotes) 439## #ssl.cipher-list = "HIGH" # default 440## 441## # (recommended to accept only TLSv1.2 and TLSv1.3) 442## #ssl.openssl.ssl-conf-cmd = ("MinProtocol" => "TLSv1.2") 443## 444## server.name = "www.example.com" 445## 446## server.document-root = "/srv/www/vhosts/example.com/www/" 447## } 448## 449 450## If you have a .crt and a .key file, specify both ssl.pemfile and ssl.privkey, 451## or cat them together into a single PEM file: 452## $ cat /etc/ssl/private/lighttpd.key /etc/ssl/certs/lighttpd.crt \ 453## > /etc/ssl/private/lighttpd.pem 454## 455#ssl.pemfile = "/etc/ssl/private/lighttpd.pem" 456# 457# or 458# 459#ssl.privkey = "/etc/ssl/private/privkey.pem" 460#ssl.pemfile = "/etc/ssl/private/cert.pem" 461 462## 463## optionally pass the CA certificate here. 464## 465## 466#ssl.ca-file = "" 467 468## 469## and the CRL revocation list here. 470## 471## 472#ssl.ca-crl-file = "" 473 474## 475####################################################################### 476 477####################################################################### 478## 479## custom includes like vhosts. 480## 481#include conf_dir + "/conf.d/config.conf" 482#include conf_dir + "/vhosts.d/*.conf" 483## 484####################################################################### 485