1

我有一个 lighttpd 服务器,其网站位于/home/httpd/example.com/httpdocs中,我有一个名为file.php的文件。当我输入http://en.example.com/file.php时,我想显示默认网站目录中的file.php(如上所述)。

所以我使用了这里描述的文档根:

http://redmine.lighttpd.net/wiki/1/Server.document-rootDetails

以这种方式:

$HTTP["host"] =~ "en.example.com/file.php" {
        server.document-root = "/home/httpd/example.com/httpdocs/"
}

但不幸的是,当我在浏览器中键入http://en.example.com/file.php时,我收到错误 404。我做错了什么以及如何修复它以使其正常工作?

4

1 回答 1

2

在示例 URL http://en.example.com/file.php的情况下,主机只是en.example.com而不是en.example.com/file.php/file.php是 URL 路径)。所以试试这个:

$HTTP["host"] =~ "en.example.com" {
    server.document-root = "/home/httpd/example.com/httpdocs/"
}
于 2009-12-29T20:31:32.260 回答