Toto je starší verze dokumentu!
Tyto konfigurace dáváme do /etc/lighttpd/sites-available/ a zapínáme symlinkem ze sites-available do sites-enabled/jmeno.conf.
Základní stránka pro statický web bez PHP.
# Default vhost
$HTTP["host"] == "site.example.com" {
server.document-root = "/var/www/html"
include "snippets/example.com-certs.conf"
include "snippets/http-to-https.conf"
}
Stránka pro weby v PHP.
# PHP vhost
$HTTP["host"] == "php.example.com" {
server.document-root = "/var/www/php"
index-file.names = ("index.php", "index.html")
include "snippets/example.com-certs.conf"
include "snippets/http-to-https.conf"
## Start an FastCGI server for php (needs the php5-cgi package)
fastcgi.server += ( ".php" =>
((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/var/run/lighttpd/php.socket",
"max-procs" => 1,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "10000"
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"
))
)
}
Pro stránky v PERLu..
# Perl vhost
$HTTP["host"] == "perl.example.com" {
server.document-root = "/var/www/perl"
alias.url = ( "/cgi" => "/var/www/perl/cgi/" )
$HTTP["url"] =~ "^/cgi/" {
cgi.assign = (".cgi" => "/usr/bin/perl")
}
include "snippets/example.com-certs.conf"
include "snippets/http-to-https.conf"
}
Pro stránky v C.
# C vhost
$HTTP["host"] == "c.example.com" {
server.document-root = "/var/www/c"
index-file.names = ("index.c") #Nahradit jménem spustitelné binárky
$HTTP["url"] =~ "/" {
cgi.assign = (".c" => "")
}
include "snippets/example.com-certs.conf"
include "snippets/http-to-https.conf"
}
# Ruby vhost
$HTTP["host"] == "ruby.example.com" {
server.document-root = "/var/www/ruby"
cgi.assign = (
".rb" => "/usr/bin/ruby",
".erb" => "/usr/bin/eruby",
)
include "snippets/example.com-certs.conf"
include "snippets/http-to-https.conf"
}