• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

[gelöst] Virtueller Host nicht im Netz erreichbar

Hallo.

Ich habe mir auf einem SLES-11 unter Apache2 einen Virtuellen Host namens kbase.stadtwerke.de angelegt.
Dieser ist auf dem Server unter http://localhost oder auch unter http://kbase.stadtwerke.de gut erreichbar.

Wenn ich nun versuche von einem anderen PC im gleichen Netzwerk auf den Webserver zuzugreifen, also auch dort mit http://kbase.stadtwerke.de, dann zeigt mir der Browser nur das Standard-Indexfile vom Apache, also das altbekannte 'It works!'. Was bedeutet, das er nicht auf den Virtuellen Host zugreift, sondern auf das Standarverzeichnis /srv/www/htdocs.

Der Apache lauscht auf Port 80.
Irgendwo habe ich einen Knoten im Hirn, ..., was mache ich falsch?
 
transwarp schrieb:
Irgendwo habe ich einen Knoten im Hirn, ..., was mache ich falsch?
Nja, du könntest uns z.B. mit dem Abschnitt der vHost-Konfiguration versorgen, oder mal in den logfiles nachsehen, was dort auftaucht.
Auf welche IP löst der 2. Rechner denn die kbase.stadtwerke.de-Adresse auf?
 
kbase.stadtwerke.de wird auf dem zweiten PC mit der IP-Adresse des Webservers aufgelöst, in meinem Fall ist das die 192.168.0.32.

Hier meine vhosts-Konfiguration namens kbase.stadtwerke.de.conf
Code:
<VirtualHost kbase.stadtwerke.de>
    ServerAdmin admin@stadtwerke.de
    ServerName kbase.stadtwerke.de

    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    DocumentRoot /srv/www/vhosts/kbase.stadtwerke.de/faq

    # if not specified, the global error log is used
    ErrorLog /var/log/apache2/kbase.stadtwerke.de-error_log
    CustomLog /var/log/apache2/kbase.stadtwerke.de-access_log combined

    # don't loose time with IP address lookups
    HostnameLookups Off

    # needed for named virtual hosts
    UseCanonicalName Off

    # configures the footer on server-generated documents
    ServerSignature On


    # Optionally, include *.conf files from /etc/apache2/conf.d/
    #
    # For example, to allow execution of PHP scripts:
    #
    # Include /etc/apache2/conf.d/mod_php4.conf
    #
    # or, to include all configuration snippets added by packages:
    # Include /etc/apache2/conf.d/*.conf


    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the realname directory are treated as applications and
    # run by the server when requested rather than as documents sent to the client.
    # The same rules about trailing "/" apply to ScriptAlias directives as to
    # Alias.
    #
    ScriptAlias /cgi-bin/ "/srv/www/vhosts/kbase.stadtwerke.de/cgi-bin/"

    # "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
    # CGI directory exists, if you have one, and where ScriptAlias points to.
    #
    <Directory "/srv/www/vhosts/kbase.stadtwerke.de/cgi-bin">
    AllowOverride None
    Options +ExecCGI -Includes
    Order allow,deny
    Allow from all
    </Directory>


    # UserDir: The name of the directory that is appended onto a user's home
    # directory if a ~user request is received.
    #
    # To disable it, simply remove userdir from the list of modules in APACHE_MODULES
    # in /etc/sysconfig/apache2.
    #
    <IfModule mod_userdir.c>
    # Note that the name of the user directory ("public_html") cannot simply be
    # changed here, since it is a compile time setting. The apache package
    # would have to be rebuilt. You could work around by deleting
    # /usr/sbin/suexec, but then all scripts from the directories would be
    # executed with the UID of the webserver.
    UserDir public_html
    # The actual configuration of the directory is in
    # /etc/apache2/mod_userdir.conf.
    Include /etc/apache2/mod_userdir.conf
    # You can, however, change the ~ if you find it awkward, by mapping e.g.
    # http://www.example.com/users/karl-heinz/ --> /home/karl-heinz/public_html/
    #AliasMatch ^/users/([a-zA-Z0-9-_.]*)/?(.*) /home/$1/public_html/$2
    </IfModule>


    #
    # This should be changed to whatever you set DocumentRoot to.
    #
    <Directory "/srv/www/vhosts/kbase.stadtwerke.de/faq">
    
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs-2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks
    
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None
    
    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all
    
    </Directory>

</VirtualHost>


und die Datei /etc/apache2/listen.conf

Code:
Listen 80
#Listen 8880


<IfDefine SSL>
    <IfDefine !NOSSL>
    <IfModule mod_ssl.c>

        Listen 443

    </IfModule>
    </IfDefine>
</IfDefine>


# Use name-based virtual hosting
# 
# - on a specified address / port:
#
#NameVirtualHost 12.34.56.78:80
#
# - name-based virtual hosting:
#
#NameVirtualHost *:80
#
# - on all addresses and ports. This is your best bet when you are on
#   dynamically assigned IP addresses:
#
#NameVirtualHost *
 
Hi,
da seh ich doch schon was:
In deiner vhosts-Konfiguration bitte anstatt <VirtualHost kbase.stadtwerke.de> ein <VirtualHost *:80> schreiben und in der httpd.conf ebenfalls ein NameVirtualHost *:80 also das Kommentarzeichen entfernen -> nach einem rcapache force-reload sollte der Hase laufen, wie er soll ;)
 
Super-Sache!
Irgendwann sieht man den Wald vor lauter Bäumen nicht und dabei ist die Lösung so einfach.
Gut das ich Euch habe :D.

Läuft prima jetzt. Vielen Dank!
 
Oben