Lighttpd Subdomains

lighttpdsubdomainvirtualhost

$HTTP["host"] == "example.com" {
    server.document-root        = "/var/www/vhosts/example.com/httpdocs/development/api"
    server.errorlog         = "/var/log/lighttpd/error.log"
    accesslog.filename          = "/var/log/lighttpd/access.log"
}

$HTTP["host"] == "api.example.com" {
    server.document-root        = "/var/www/vhosts/example.com/httpdocs/development/api"
    server.errorlog         = "/var/log/lighttpd/error.log"
    accesslog.filename          = "/var/log/lighttpd/access.log"
}

$HTTP["host"] == "example.org" {
    server.document-root        = "/var/www/vhosts/example.com/httpdocs/development/services"
    server.errorlog         = "/var/log/lighttpd/error.log"
    accesslog.filename          = "/var/log/lighttpd/access.log"
}

Above is an extract of my lighttpd.conf. example.com and example.org are working fine. Any idea why api.example.com refuses to work?

Thanks!

Best Answer

Make sure "api.example.com" resolves to the IP of your server in DNS.

Related Topic