Lighttpd vhost werden nicht erkannt

Apache, Lighttpd, nginx, Cherokee
ruepel
Posts: 7
Joined: 2008-02-14 12:41

Lighttpd vhost werden nicht erkannt

Post by ruepel » 2008-02-14 13:03

Hallo Board,

nach einer durchwachten Nacht bin ich mit meinem Latein am Ende. Ich habe auf meinem Debian Server lighttpd eingerichtet und versuche nun meine Domains darauf zu konnektieren. Allerdings schein Lighttpd meine vhost nicht zu akzeptieren bzw. konnektiert die Seiten immer mit dem document-root.

Hier mal meine lighttpd.conf

Code: Select all

server.modules          = ( 
      "mod_rewrite",
      "mod_alias",
      "mod_access",
      "mod_auth",
      "mod_status",
      "mod_simple_vhost",
      "mod_evhost",
      "mod_userdir",
      "mod_secdownload",
      "mod_fastcgi",
      "mod_accesslog"
 )
fastcgi.server = ( ".php" => ((
           "bin-path" => "/usr/bin/php5-cgi",     
       "socket" => "/tmp/php.socket"    
           )))
server.document-root = "/var/www/hosts"
$HTTP["host"] =~ "(^|.)blahblah.de.de$" {                                                                     
    server.document-root = "/var/www/hosts/blahblah.de"                                                                   
    server.errorlog = "/var/log/hosts/blahblah.de/error.log"                                                               
    accesslog.filename = "/var/log/hosts/blahblah.de/access.log"                                                           
    server.error-handler-404 = "/var/www/hosts/blahblah.de/error/e404.php"                                                     



Mit den simple_vhost gehts übrigens auch nicht, was ich ausprobiert habe, weshalb das Modul noch in der .conf steht.

Code: Select all

simple-vhost.server-root = "/var/www/hosts/blahblah.de"
simple-vhost.default-host = "blahblah.de"
simple-vhost.document-root = "/blahblah.de"


Nach den vielen HowTos, die ich gelesen ( :google: und nur vielleicht auch verstanden ;) ) habe, müsste es doch eigentlich funktionieren oder sehe ich das falsch? Denn die DNS Einträge stimmen auf jeden Fall, denn mit der URL lande ich auf dem Server, allerdings eben hier

Code: Select all

server.document-root = "/var/www/hosts"
und dann kann ich mich in das Dir "blahblah.de" klicken und bekomme meine Seite angezeigt.
Danke schonmal!
_ruepel

User avatar
Joe User
Project Manager
Project Manager
Posts: 11138
Joined: 2003-02-27 01:00
Location: Hamburg

Re: Lighttpd vhost werden nicht erkannt

Post by Joe User » 2008-02-14 13:18

Nachfolgend eine funktionierende minimal lighttpd.conf (Bitte selbst anpassen/erweitern):

Code: Select all

server.username = "lighttpd"
server.groupname = "lighttpd"
server.stat-cache-engine = "fam"
server.event-handler = "linux-sysepoll"
server.pid-file = "/var/run/lighttpd.pid"
server.errorlog = "/var/log/lighttpd/error.log"
server.document-root = "/var/www/localhost/default"
server.name = "sub.domain.tld"
server.modules = (
    "mod_rewrite",
    "mod_redirect",
    "mod_alias",
    "mod_access",
    "mod_auth",
    "mod_setenv",
    "mod_expire",
    "mod_fastcgi",
    "mod_cgi",
    "mod_ssi",
    "mod_compress",
    "mod_accesslog",
)
server.indexfiles = (
    "index.xhtml",
    "index.html",
    "index.htm",
    "index.php",
)
mimetype.assign = (
    ".pdf"     => "application/pdf",
    ".sig"     => "application/pgp-signature",
    ".spl"     => "application/futuresplash",
    ".class"   => "application/octet-stream",
    ".ps"      => "application/postscript",
    ".torrent" => "application/x-bittorrent",
    ".dvi"     => "application/x-dvi",
    ".pac"     => "application/x-ns-proxy-autoconfig",
    ".swf"     => "application/x-shockwave-flash",
    ".tgz"     => "application/x-tgz",
    ".mp3"     => "audio/mpeg",
    ".m3u"     => "audio/x-mpegurl",
    ".wma"     => "audio/x-ms-wma",
    ".wax"     => "audio/x-ms-wax",
    ".ogg"     => "application/ogg",
    ".wav"     => "audio/x-wav",
    ".xbm"     => "image/x-xbitmap",
    ".xpm"     => "image/x-xpixmap",
    ".xwd"     => "image/x-xwindowdump",
    ".asc"     => "text/plain",
    ".c"       => "text/plain",
    ".h"       => "text/plain",
    ".cc"      => "text/plain",
    ".cpp"     => "text/plain",
    ".hh"      => "text/plain",
    ".hpp"     => "text/plain",
    ".conf"    => "text/plain",
    ".log"     => "text/plain",
    ".text"    => "text/plain",
    ".txt"     => "text/plain",
    ".diff"    => "text/plain",
    ".patch"   => "text/plain",
    ".ebuild"  => "text/plain",
    ".eclass"  => "text/plain",
    ".rtf"     => "application/rtf",
    ".bmp"     => "image/bmp",
    ".tif"     => "image/tiff",
    ".tiff"    => "image/tiff",
    ".ico"     => "image/x-icon",
    ".mpeg"    => "video/mpeg",
    ".mpg"     => "video/mpeg",
    ".mov"     => "video/quicktime",
    ".qt"      => "video/quicktime",
    ".avi"     => "video/x-msvideo",
    ".asf"     => "video/x-ms-asf",
    ".asx"     => "video/x-ms-asf",
    ".wmv"     => "video/x-ms-wmv",
    ".tbz"     => "application/x-bzip-compressed-tar",
    ".tar.bz2" => "application/x-bzip-compressed-tar",
    ".tar.gz"  => "application/x-tgz",
    ".bz2"     => "application/x-bzip",
    ".gz"      => "application/x-gzip",
    ".tar"     => "application/x-tar",
    ".zip"     => "application/zip",
    ".jpeg"    => "image/jpeg",
    ".jpg"     => "image/jpeg",
    ".png"     => "image/png",
    ".gif"     => "image/gif",
    ".svg"     => "image/svg+xml",
    ".xhtml"   => "text/html",
    ".html"    => "text/html",
    ".htm"     => "text/html",
    ".dtd"     => "text/xml",
    ".xml"     => "text/xml",
    ".css"     => "text/css",
    ".js"      => "text/javascript",
    ".php"     => "application/x-httpd-php",
    ""         => "text/plain",
)
static-file.exclude-extensions = (
    ".pl",
    ".cgi",
    ".fcgi",
    ".php",
)
dir-listing.activate = "disable"
dir-listing.hide-dotfiles = "enable"
dir-listing.encoding = "UTF-8"
dir-listing.exclude = (
    "^.",
    "~$",
    "favicon.ico",
    "robots.txt",
)
url.access-deny = (
    "~",
    ".ini",
    ".inc",
    ".cfg",
    ".tpl",
    ".bak",
    ".dist",
    ".orig",
    ".htaccess",
    ".htpasswd",
    ".example",
    ".sample",
    ".lang",
)
fastcgi.server = (
    ".php" => (
        (
            "socket" => "/tmp/spawn-fcgi-lighttpd.sock",
            "broken-scriptfilename" => "enable",
        ),
    ),
)
cgi.assign = (
    ".pl" => "/usr/bin/perl",
    ".cgi" => "/usr/bin/perl",
)
ssi.extension = (
    ".shtml",
)
compress.filetype = (
    "text/javascript",
    "text/plain",
    "text/html",
    "text/css",
    "text/xml",
)
accesslog.filename = "/var/log/lighttpd/access.log"
accesslog.format = "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i""
$HTTP["url"] =~ ".pdf$" {
    server.range-requests = "disable"
}
$SERVER["socket"] == ":443" {
    ssl.engine = "enable"
    ssl.use-sslv2 = "disable"
    ssl.pemfile = "/etc/lighttpd/ssl/lighttpd.pem"
    ssl.ca-file = "/etc/lighttpd/ssl/demoCA/cacert.pem"
    server.document-root = "/var/www/localhost/htdocs"
    accesslog.filename = "/var/log/lighttpd/ssl_access.log"
}
$SERVER["socket"] == ":80" {
    $HTTP["host"] =~ "(^|.)domain.tld$" {
        $HTTP["host"] != "www.domain.tld" {
            url.redirect = (
                "^/(.*)" => "http://www.domain.tld/",
            )
        }
        $HTTP["host"] == "www.domain.tld" {
            server.name = "www.domain.tld"
            server.document-root = "/var/www/vhosts/www.domain.tld/htdocs"
            accesslog.filename = "/var/log/lighttpd/www_domain_tld_access.log"
        }
    }
}
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.

ruepel
Posts: 7
Joined: 2008-02-14 12:41

Re: Lighttpd vhost werden nicht erkannt

Post by ruepel » 2008-02-14 14:37

Tausend Dank!
Es funktioniert endlich, nachdem ich einige Probleme mit dem server.document-root = "/var/www/vhosts/www.blahblah.de/html" hatte ...
zuerst hatte ich kein html dir, dann stand noch http://www.blahblah.de statt dem dir blahblah.de usw. usf. -- es ist definitiv zeit für schlaf! Aber endlich kann ich auch schlafen :)

hab gleich noch das howto mit den individuellen nutzerrechten eingearbeitet und jetzt bin ich sehr zufrieden und vor allem sehr erfreut über die große community und die vielen howtos.
nu aber zack ins bett.