lighttpd Subdomain Konfiguration

Apache, Lighttpd, nginx, Cherokee
native
Posts: 119
Joined: 2003-11-18 10:38

lighttpd Subdomain Konfiguration

Post by native » 2010-10-03 10:16

Ich versuche, auf einem Server Suport für eine Domain und eine Subdomain einzurichten. Aktuell sieht es so aus: rufe ich die Subdomain auf, wird auf die Root Domain umgeleitet. Hier meine Konfig:

Code: Select all

$HTTP["host"] =~ "(^|\.)example\.com$" {
    server.document-root = "/var/www/example.com/https/"
    accesslog.filename = "/var/www/example.com/logs/serverAccess.log"
}

### sugar crm :: client relation management
$HTTP["host"] =~ "(^|\.)crm\.example\.com$" {
    server.document-root = "/var/www/sugar"

    auth.backend = "plain"
    auth.backend.plain.userfile  = "/etc/lighttpd/pwd/.passwd"

    auth.require = ( "/docs/" =>
        (
        "method" => "basic",
        "realm" => "Authorized personnel only",
        "require" => "user=meinUser"
        )
    )
}

Wobei die Subdomain eben noch einen Verzeichnisschutz bekommen soll. Kann mir jdm sagen, wo der Fehler liegt?

User avatar
daemotron
Administrator
Administrator
Posts: 2635
Joined: 2004-01-21 17:44

Re: lighttpd Subdomain Konfiguration

Post by daemotron » 2010-10-03 11:23

"(^|\.)example\.com$" trifft auch auf crm.example.com zu - entweder Du tauschst die beiden Hosts (Lighty nimmt normalerweise immer den ersten, wo der Match passt), oder Du spezifizierst den Hostnamen für den Catchall etwas genauer.
“Some humans would do anything to see if it was possible to do it. If you put a large switch in some cave somewhere, with a sign on it saying 'End-of-the-World Switch. PLEASE DO NOT TOUCH', the paint wouldn't even have time to dry.” — Terry Pratchett, Thief of Time

native
Posts: 119
Joined: 2003-11-18 10:38

Re: lighttpd Subdomain Konfiguration

Post by native » 2010-10-03 13:35

Tauschen hatte ich bereits versucht, das geht nicht. Ein Tipp, wie das am sinnvollsten spezifiziere, so dass alle Variaten wie "www.example.com", "example.com" etc erfast werden?

User avatar
daemotron
Administrator
Administrator
Posts: 2635
Joined: 2004-01-21 17:44

Re: lighttpd Subdomain Konfiguration

Post by daemotron » 2010-10-03 13:47

Man darf auch verschachteln:

Code: Select all

$HTTP["host"] =~ "(^|\.)example\.com$" {
  $HTTP["host"] =~ "(^|\.)crm\.example.com$" {
    # hier die CRM-Konfig
  }
  $HTTP["host"] !~ "(^|\.)crm\.example.com$" {
    # hier der normale virtuelle Host
  }
}
Last edited by daemotron on 2010-10-03 13:48, edited 1 time in total.
“Some humans would do anything to see if it was possible to do it. If you put a large switch in some cave somewhere, with a sign on it saying 'End-of-the-World Switch. PLEASE DO NOT TOUCH', the paint wouldn't even have time to dry.” — Terry Pratchett, Thief of Time

native
Posts: 119
Joined: 2003-11-18 10:38

Re: lighttpd Subdomain Konfiguration

Post by native » 2010-10-03 14:05

Cool, das wusste ich nicht.

Meine Konfig jetzt aus wie folgt, ich habe aber immer noch das gleiche Problem:

Code: Select all

$HTTP["host"] =~ "(^|\.)example\.com$" {

    $HTTP["host"] =~ "(^|\.)crm\.example\.com$" {
        # SugarCRM config
        server.document-root = "/var/www/sugar"

        auth.backend = "plain"
        auth.backend.plain.userfile  = "/etc/lighttpd/pwd/.passwd"

        auth.require = ( "/docs/" =>
            (
            "method" => "basic",
            "realm" => "Authorized personnel only",
            "require" => "user=MyUser"
            )
        )

    }

    $HTTP["host"] !~ "(^|\.)crm\.example\.com$" {
        # main host config
        server.document-root = "/var/www/example.com/https"
        accesslog.filename = "/var/www/example.com/logs/serverAccess.log"
    }
}


Noch eine Idee?