Lighttp und Subdomains

Apache, Lighttpd, nginx, Cherokee
User avatar
Joe User
Project Manager
Project Manager
Posts: 11138
Joined: 2003-02-27 01:00
Location: Hamburg

Re: Lighttp und Subdomains

Post by Joe User » 2009-03-24 15:53

Code: Select all

$SERVER["socket"] == ":80" {
    $HTTP["host"] =~ "(^|.)domain.tld$" {
        $HTTP["host"] !~ "^(www|sub).domain.tld$" {
            url.redirect = (
                "^/(.*)" => "http://www.domain.tld/",
            )
        }
        $HTTP["host"] == "sub.domain.tld" {
            server.name = "sub.domain.tld"
            server.document-root = "/var/www/vhosts/sub.domain.tld/htdocs"
            accesslog.filename = "/var/log/lighttpd/sub_domain_tld_access.log"
         ...
        }
        $HTTP["host"] == "www.domain.tld" {
            server.name = "www.domain.tld"
            server.document-root = "/var/www/vhosts/www.domain.tld/htdocs"
            accesslog.filename = "/var/log/lighttpd/www_domain_tld_access.log"
         ...
      }
   }
}
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.