tags:

views:

32

answers:

1

Hi everybody

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

A: 

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.

Eric Towers
Option 2 looks interesting. Gonna check that out. I´ve using option 1 on my other servers and it works like a charm.
Mr Rebel
Thanks a lot Eric
Mr Rebel