1、常规虚拟主机设定
2、简单虚拟主机 mod_simple_vhost 3、复杂虚拟设置匹配 mod_evhost
引用
$HTTP["host"] == "www.linuxfly.org" {
server.name = "www.linuxfly.org" server.document-root = "/var/www/html/linuxfly" server.errorlog = "/var/log/linuxfly-error.log" accesslog.filename = "/var/log/linuxfly-access.log" }
引用
server-root + hostname + document-root
引用
server-root + default-host + document-root
引用
server.modules += ("mod_simple_vhost")
simple-vhost.server-root = "/var/www/html/" simple-vhost.default-host = "linuxfly.org" simple-vhost.document-root = "www" $HTTP["host"] == "news.linuxfly.org" { server.document-root = "/var/www/html/linuxfly.org/news/" }
引用
/var/www/html + linuxfly.org + www
即 /var/www/html/linuxfly.org/www
引用
$HTTP["host"] == "www.linuxfly.cn" {
server.document-root = "/var/www/html/linuxfly.cn/www/" }
引用
$HTTP["host"] != "www.linuxfly.cn" {
simple-vhost.server-root = "/var/www/html/" simple-vhost.default-host = "linuxfly.org" simple-vhost.document-root = "www" }
引用
# define a pattern for the host url finding
# %% => % sign # %0 => domain name + tld # %1 => tld # %2 => domain name without tld # %3 => subdomain 1 name # %4 => subdomain 2 name
引用
server.modules += ("mod_evhost")
$HTTP["host"] =~ "www\.linuxfly" { evhost.path-pattern = "/var/www/html/%0/%3" }
引用
%0 = linuxfly.org
%3 = www 即: /var/www/html/linuxfly.org/www
引用
$HTTP["host"] =~ "^(www|www1)\.linuxfly" {
evhost.path-pattern = "/var/www/html/%0/%3" }
引用
www1.linuxfly.org => /var/www/html/linuxfly.org/www1
www2.linuxfly.org => /var/www/html/linuxfly.org/www2
引用
$HTTP["host"] ~= "^(host\.linuxfly\.org|host\.linuxfly\.cn)$" {......}
$HTTP["host"] ~= "(^|\.)linuxfly\.org$" {......}
|