在lighttpd中添加子域支持

发布于 2024-08-16 04:28:37 字数 793 浏览 3 评论 0原文

我有一个 lighttpd 服务器,其网站位于 /home/httpd/example.com/httpdocs 中,并且有一个名为 file.php 的文件。当我输入 http://en.example.com/file.php< /em> 我想显示默认网站目录中的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。我做错了什么以及如何修复它以使其正常工作?

I have a lighttpd server with website placed in /home/httpd/example.com/httpdocs and there I have a file called file.php. When I type http://en.example.com/file.php I would like to display file.php that is in default website directory (mentioned above).

So I used document-root described here:

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

in this manner:

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

But unfortunately when I type http://en.example.com/file.php into browser I get error 404. What I do wrong and how can I fix it to work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扭转时空 2024-08-23 04:28:37

对于示例 URL http://en.example.com/file.php< /a>,主机只是 en.example.com 而不是 en.example.com/file.php (/file.php 是 URL 路径)。所以试试这个:

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

In the case of the example URL http://en.example.com/file.php, the host is just en.example.com and not en.example.com/file.php (/file.php is the URL path). So try this:

$HTTP["host"] =~ "en.example.com" {
    server.document-root = "/home/httpd/example.com/httpdocs/"
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文