The features that make the configuration of Lighttpd very powerful, yet keep it concise, are selectors. A selector is a criterion within a curly-braced region of the configuration that only applies if the criterion is met. After the optional else keyword, another curly-braced region can be added that applies for the inverse of the criteria. So the basic formula for a selector is one of the following:
criteria {
configuration }
or
criteria {
configuration }
else {
configuration }
Suppose that we want to serve .html
files from the subdirectory /xhtml
of our document root as application/xhtml+xml
and from any other directory as text/html
:
mimetype.assign = (...[our list of mime types, omitting .html]...) $HTTP["url"] =~ "^/xhtml" { mimetype.assign += (".html" => "application/xhtml+xml") } else { mimetype.assign += (".html" => "text/html") }
As we can see in the example, each criterion consists of a value, an operator, and a pattern. The value to compare is either $SERVER["socket...