lighttpd 虚拟主机不工作

lighttpd virtualhost does not work

我有一台安装了 lighttpd 的服务器,我想为我的域使用虚拟主机。这是我所做的,但它不起作用。

lighttpd 版本为 1.4.35

simple-vhost.server-root = "/var/www/"
simple-vhost.default-host = "mydomain.net"
simple-vhost.document-root = "mydomainnet"

$HTTP["host"] =~ "(^|\.)mydomain.net" {
    server.document-root = "/var/www/mydomainnet"
    server.errorlog = "/var/log/lighttpd/mydomain/error.log"
    accesslog.filename = "/var/log/lighttpd/mydomain/access.log"
    #server.error-handler-404 = "/e404.php"
}

我的服务器的域名到 ip 也是正确的。

我忘记了域末尾的“$”。

simple-vhost.server-root = "/var/www/"
simple-vhost.default-host = "mydomain.net"
simple-vhost.document-root = "mydomainnet"

$HTTP["host"] =~ "(^|\.)mydomain.net$" {
    server.document-root = "/var/www/mydomainnet"
    server.errorlog = "/var/log/lighttpd/mydomain/error.log"
    accesslog.filename = "/var/log/lighttpd/mydomain/access.log"
    #server.error-handler-404 = "/e404.php"
}