Lighttpd config
From wikinotes
Documentation
Locations
/usr/local/etc/lighttpd/lighttpd.conf
config
Validation
lighttpd -tt -f /usr/local/etc/lighttpd/lighttpd.conf # validate syntax valid
Example
lighttpd.conf
is the config referenced by the server startup,
but you can split your code into other files andinclude
relative paths to other.conf
files.
# ================================================ # global options are configured outside of a block # ================================================ server.document-root = "/usr/local/www" + "example.org" server.port = 80 server.username = "www" server.groupname = "www" mimetype.assign = ( ".html" => "text/html", ".txt" => "text/plain", ".jpg" => "image/jpeg", ".png" => "image/png" ) static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" ) index-file.names = ( "index.html" ) # ================================================ # blocks can be treated as conditionals if/else/.. # within blocks you can assign or override global options # ================================================ $HTTP["host"] == "example.org" { server.document-root = "/usr/local/www" + "example.org" $HTTP["url"] =~ "^/download/" { dir-listing.activate = "enable" } } else $HTTP["host"] == "foobar.net" { server.document-root = "/usr/local/www" + "foobar.net" }
Components
Modules
Modules contain the features you may want to use.
Want HTTP Basic auth? Setting EnvVars? WebDav?
these features are enabled/layered in by modules.Modules must be:
- installed (some modules ship with lighttpd by default)
- enabled
Modules may be:
- included (enables module, with a default configuration)
NOTE:
Think of the
conf.d/*.conf
module files as example/default configurations.
you can use them as-is, or use them as a reference for your own configuration.
WARNING:
The order of modules is important.
- request gating/modification modules must be listed first
- everything else here
- dynamic handlers must be last
# enable a module server.modules = ( "mod_access," "mod_authn", ) # enable/configure a module with a sane default config include conf_dir + "/webdav"