![Lighttpd 子域名](https://linux22.com/image/495709/Lighttpd%20%E5%AD%90%E5%9F%9F%E5%90%8D.png)
$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"
}
以上是我的 lighttpd.conf 的摘录。example.com 和 example.org 运行正常。知道为什么 api.example.com 无法工作吗?
谢谢!
答案1
确保“api.example.com”在 DNS 中解析为您服务器的 IP。