将子域支持添加到lighttpd [英] Adding subdomain support into lighttpd

查看:224
本文介绍了将子域支持添加到lighttpd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个lighttpd服务器,其网站放在 /home/httpd/example.com/httpdocs 中,那里有一个名为 file.php 的文件。当我输入 http://en.example.com/file.php 我想在默认的网站目录(上面提到)中显示 file.php



所以我使用了document-root在此描述:



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 into浏览器我得到错误404.我做错了,我该如何解决它的工作?

解决方案

在示例的情况下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/
}


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?

解决方案

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/"
}

这篇关于将子域支持添加到lighttpd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆