Intelligent lighttpd directory structure w/evhost.path-pattern
Searched high and low to find this silly little info. Finally found it here.
# define a pattern for the host url finding
# %% => % sign
# %0 => domain name + tld
# %1 => tld
# %2 => domain name without tld
# %3 => subdomain 1 name
# %4 => subdomain 2 name
# Set default vhost server location here
evhost.path-pattern = "/www/%0/htdocs"
# If we don't have a %3, default to htdocs
$HTTP["host"] =~ "^[^.]+\.[^.]+$" {
evhost.path-pattern = "/www/%2.%1/htdocs/"
}
# If we don't have a %4, find the subdomain
$HTTP["host"] =~ "^[^.]+\.[^.]+\.[^.]+$" {
evhost.path-pattern = "/www/%2.%1/subdomains/%3/"
}
# If we have a %4, find the subdomain2.subdomain1. If we have have %4+, use %4
# anyway. If you have 4+, write a explicit rule for doc-root.
$HTTP["host"] =~ "^.+\.[^.]+\.[^.]+\.[^.]+$" {
evhost.path-pattern = "/www/%2.%1/subdomains/%4.%3/"
}
Now my only wishlist is to do something similar for var.logdir, but %[1-4] is only set up with evhost. So, do you do anything smarter than this for your server?





I use varnish for reverse proxy and N processes x lighttpd instance perr site, each one with its own vconfig file and username:group identity.
This means, that all my sites on the machine are isolated from each other with quite strict permissions, so one user can’t get into other users website files.
Works like a charm.
Cool, I don’t need anything that complex. Just my personal sites and a friends domain on the server.
I didn’t like the way I had listed up there. Here is what I am using now (self explanatory I think)