Lighttpd – configure simple vhost multiple domain

Posted: February 12, 2011 in archlinux, Debian, Freebsd, Slackware

I’am suing Lighttpd for serve multiple domain …

Always forget how to configure ….

## For 1 domain

simple-vhost.server-root = “/var/www/servers/”

simple-vhost.default-host = “kami337fm.com”

simple-vhost.document-root = “pages”

$HTTP[“host”] == “kami337fm.com” {

server.document-root = “/var/www/servers/news2.example.org/pages/”

}

## For host www and without www (www.kami337fm.com & kami337fm.com)

$HTTP[“host”] =~ “(^|\.)kami337fm\.com$” {

server.document-root = “/var/www/servers/news2.example.org/pages/”

}

## For host .com and .org (www.kami337fm.com & kami337fm.org)

$HTTP[“host”] =~ “^(www\.kami337fm\.org|www\.kami337fm\.com)$” {

server.document-root = “/var/www/servers/news2.example.org/pages/”

}

## for 2 and more host

$HTTP[“host”] !~ “^(test1\.example\.org|test2\.example\.org)$” {

simple-vhost.server-root = “/var/www”

simple-vhost.document-root = “/html/”

## the default host if no host is sent

simple-vhost.default-host = “example.org”

}

$HTTP[“host”] == “test1.example.org” {

server.document-root = “/home/user/sites/test1.example.org/”

accesslog.filename = “/home/user/sites/logs/test1.example.org.access.log”

}

$HTTP[“host”] == “test2.example.org” {

server.document-root = “/home/user/sites/test2.example.org”

accesslog.filename = “/home/user/sites/logs/test2.example.org.access.log”

}

 

Comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s