"ServerAlias" in lighttpd
I’ve been asked a few times the quick and easy way to make somedomain.whatever all point to the same place with lighttpd.
One of the things I have to come like the most about lighttpd is conditionals and the ability to use perl-style regexps.
The “virtual host” below is for an exact match to weblog.textdrive.com
$HTTP["host"] == "weblog.textdrive.com" {
server.indexfiles = ( "index.php" )
server.document-root = "/home/weblog/public/"
server.error-handler-404 = "/index.php"
fastcgi.server = (
".php" =>
( "localhost" =>
(
"socket" => "/tmp/weblogphp5-fcgi.socket",
"bin-path" => "/usr/local/www/cgi-bin/php5-fcgi",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "5000"
)
)
)
)
}
So if you want weblog.textdrive.com and weblog.textdrive.cn to pull the same site without adding anything, replace = = with =~ and whack off the dot com.
$HTTP["host"] =~ "weblog.textdrive" {
server.indexfiles = ( "index.php" )
server.document-root = "/home/weblog/public/"
server.error-handler-404 = "/index.php"
fastcgi.server = (
".php" =>
( "localhost" =>
(
"socket" => "/tmp/weblogphp5-fcgi.socket",
"bin-path" => "/usr/local/www/cgi-bin/php5-fcgi",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "5000"
)
)
)
)
}
or
$HTTP["host"] =~ "weblog.textdrive.(com|cn)" {
server.indexfiles = ( "index.php" )
server.document-root = "/home/weblog/public/"
server.error-handler-404 = "/index.php"
fastcgi.server = (
".php" =>
( "localhost" =>
(
"socket" => "/tmp/weblogphp5-fcgi.socket",
"bin-path" => "/usr/local/www/cgi-bin/php5-fcgi",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "5000"
)
)
)
)
}
·:· Posted 16 May 2005, 05:12 by Jason Hoffman to Lighttpd |
