多个文档根

发布于 2024-09-29 02:59:00 字数 405 浏览 5 评论 0原文

我有一个特殊的要求。我将 evhost 与 lighttpd 一起使用,除此之外一切正常:

$HTTP["host"] =~ "^[^.]+\.[^.]+$" {
     evhost.path-pattern = vhosts_dir + "/customers/%2.%1/public/"
     evhost.path-pattern = vhosts_dir + "/customershops/%2.%1/public/"
     evhost.path-pattern = vhosts_dir + "/company/%2.%1/public/"
}

所以我想使我的模式上方的目录成为“动态”。或者实际上只是查看这三个目录,然后使用正确的虚拟主机目录。

最好的问候

反叛先生

I´ve got a special request. I use evhost with lighttpd and everything works fine except this:

$HTTP["host"] =~ "^[^.]+\.[^.]+$" {
     evhost.path-pattern = vhosts_dir + "/customers/%2.%1/public/"
     evhost.path-pattern = vhosts_dir + "/customershops/%2.%1/public/"
     evhost.path-pattern = vhosts_dir + "/company/%2.%1/public/"
}

So I would like to make the directory above my pattern to be "dynamic". Or actually just look inside the three directories and then use the right vhost directory.

Best regards

Mr Rebel

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

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

发布评论

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

评论(1

深者入戏 2024-10-06 02:59:00

mod_evhost 必须能够从提交的主机名的各个部分中找出一个文档根。它无法猜测三个选项,也无法尝试找出存在哪一个(特别是如果无意中碰巧有多个选项)。

您要么必须在主机名中为 mod_evhost 提供足够的信息才能明确地选择路径,要么必须在文件系统中进行至少一级重定向。

选项 1:

evhost.path-pattern = vhosts_dir + "/%2.%1/public/"

This loses all the customer/store/company information you want to capture, but it actually makes it possible for mod_evhost to work.

选项 2:您可以根据需要拆分目录,并创建一个充满这些目录链接的目录。 FS 具有可见的结构,mod_evhost 只需猜测重定向到您的结构的链接的名称。

  directory_containing_links/
    foo.bar -> ./customers/foo.bar/public/
    foo.baz -> ./customershops/foo.baz/public/
    foo.qux -> ./company/foo.qux/public/
    quux.bar -> ./customershops/quux.bar/public/
    quux.baz -> ./customers/quux.baz/public/
    (and so on, with one link per site)
  directory_containing_sites/
    company/foo.qux/public/(web site here)
    customers/foo.bar/public/(web site here)
    customers/quux.baz/public/(web site here)
    customershops/foo.baz/public/(web site here)
    customershops/quux.bar/public/(web site here)

Then your evhost pattern is

evhost.path-pattern = directory_containing_links + "/%2.%1/"

Note that directory_containing_links and directory_containing_sites can be the same directory.

mod_evhost has to be able to figure out the one document root from the parts of the submitted hostname. It can't guess among three options, nor try to figure out which one exists (especially if more than one inadvertently happens to do so).

You will either have to give mod_evhost enough information in the host names to unambiguously pick out a path, or you will have to engage in at least one level of redirection in your filesystem.

Option 1:

evhost.path-pattern = vhosts_dir + "/%2.%1/public/"

This loses all the customer/store/company information you want to capture, but it actually makes it possible for mod_evhost to work.

Option 2: You have the directories split out as you want, and a directory full of links to those directories. The FS has the visible structure and mod_evhost only has to guess the name of the link that redirects into your structure.

  directory_containing_links/
    foo.bar -> ./customers/foo.bar/public/
    foo.baz -> ./customershops/foo.baz/public/
    foo.qux -> ./company/foo.qux/public/
    quux.bar -> ./customershops/quux.bar/public/
    quux.baz -> ./customers/quux.baz/public/
    (and so on, with one link per site)
  directory_containing_sites/
    company/foo.qux/public/(web site here)
    customers/foo.bar/public/(web site here)
    customers/quux.baz/public/(web site here)
    customershops/foo.baz/public/(web site here)
    customershops/quux.bar/public/(web site here)

Then your evhost pattern is

evhost.path-pattern = directory_containing_links + "/%2.%1/"

Note that directory_containing_links and directory_containing_sites can be the same directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文