Configuration¶
See:- Config - The config syntax and structure in detail
- Modules - Available modules
- Angel - Recommended supervisor for lighttpd
- AngelConfig - The angel config syntax
- Howtos - Collection of different howtos
- Lua topics
- LuaConfig - Write your config as lua script (basic concepts)
- LuaAPI - Lua api reference
- LuaExamples - Some examples what you can do with lua
Have a look at the doc/ directory in the source tree too (includes a nice mime-type list).
Really small example for static files¶
setup {
listen "0.0.0.0:80";
# workers 2;
mime_types = ( ".htm" => "text/html", ".txt" => "text/plain" );
}
docroot "/var/www";
alias "/doc" => "/usr/share/doc";
index ( "index.html" );
Example¶
setup {
module.load ( "mod_fastcgi", "mod_status", "mod_accesslog", "mod_dirlist" );
listen "0.0.0.0:80";
listen "[::]:80"; # ipv6
# workers 2;
mime_types = ( ".htm" => "text/html", ".txt" => "text/plain" );
log = [ "debug": "", "*": "/var/log/lighttpd2/error.log" ]; # log everything except debug to /var/log/lighttpd2/error.log
# log = [ "*": "stderr" ]; # log everything to stderr
# debug.log_request_handling = true;
accesslog = "/var/log/lighttpd2/access.log";
accesslog.format = "%h %V %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"";
static.exclude_extensions = ( ".php" );
}
# named action block
php {
if phys.path =$ ".php" {
if physical.is_file {
fastcgi "unix:/var/run/lighttpd/sockets/www-default-php.sock";
}
}
}
if req.path == "/status" { status.info; }
docroot "/var/www";
alias "/phpmyadmin" => "/usr/share/phpmyadmin";
index ( "index.php", "index.html" );
dirlist;
# if you want to use urls like http://example.com/index.php/some/path (using your php files like directories), you need this:
pathinfo;
# use block "php" from above
php;