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

Virtual Hosts mit Apache2 unter SUSE 9.3

mifroe

Newbie
Hallo zusammen,

ich beschäftige mich seit ein paar Tagen mit dem Thema Apache und komme momentan nicht weiter und hoffe deswegen auf eure Hilfe. Und zwar habe ich folgendes Problem:

Ich habe auf einem 2 Rechner einen SUSE 9.3 Server aufgesetzt und dort den Apache2 gestartet. Dann unter /etc/apache2/vhosts.d 2 .conf Dateien angelegt bzw. die vhost.template kopiert und umbenammt in baer.conf und zocker.conf. Dann habe ich in diesen Dateien den DokumentRoot abgeändert auf den Pfad wo die Dateien liegen (index.htm und der Rest). Und dann noch den ServerName abgeändert auf die www-Adresse wie sie heißen soll.

Dann habe ich bei meinem "Windowsclient" die hosts Datei abgändert damit er bei 3 aufrufen nicht auf das I-Net zugreift.

So und ab hier folgt das Problem, wenn ich die Adressen

"www.reifenservice-baer.de"
und
"www.callofdutyzocker.de"
aufrufe funktioniert dies, beide Adressen soll es auch geben. Wenn ich nun die dritter Adresse aufrufe (www.winterzocker.de) dann kommt der Inhalt von "www.reifenservice-baer.de". Ich frage mich jetzt was soll das? Ich habe es mit 2 Browsern ausprobiert (Firefox 1.0.4 und Internet Explorer 6.0) und bei beiden wurde auch schon der Cache geleert und trotzdem immer das gleiche.

Was mache ich falsch?

Vielen Dank an euch.

Michael
 
OP
M

mifroe

Newbie
Ja aber es gibt ja noch nichtmal eine .conf Datei wo auf diese Adresse verwiesen wird bzw. auf die andere www Adresse.

Gibt es vielelicht noch irgendwo ein Cache auf dem Server den ich leeren kann?

Gruß
 

texus

Member
Du bist dir aber sicher das du unterschiedliche "Document Roots" definiert hast und das in diesen Roots auch unterschiedliche Inhalte zu finden sind ??

Tschuldigung die Frage, aber anders kann ich mir das einfach nicht vorstellen.


MfG
texus
 
OP
M

mifroe

Newbie
Hi zusammen,

also hier mal die 3 Configs und die hosts Datei von windows:

1. Conf:

<VirtualHost *:80>

ServerName www.reifenservice-baer.de
DocumentRoot /srv/www/htdocs/baer

# if not specified, the global error log is used
#ErrorLog /var/log/apache2/baer_error_log
#CustomLog /var/log/apache2/baer_access_log

# 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


ScriptAlias /cgi-bin/ "/srv/www/vhosts/dummy-host.example.com/cgi-bin/"

<Directory "/srv/www/vhosts/dummy-host.example.com/cgi-bin">
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>


<IfModule mod_userdir.c>
UserDir public_html
Include /etc/apache2/mod_userdir.conf
</IfModule>


#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/srv/www/htdocs/baer">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

</VirtualHost>




2. Conf:

<VirtualHost *:80>

ServerName www.callofdutyzocker.de
DocumentRoot /srv/www/htdocs/zocker

# if not specified, the global error log is used
#ErrorLog /var/log/apache2/baer_error_log
#CustomLog /var/log/apache2/baer_access_log

# 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


ScriptAlias /cgi-bin/ "/srv/www/vhosts/dummy-host.example.com/cgi-bin/"

<Directory "/srv/www/vhosts/dummy-host.example.com/cgi-bin">
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>


<IfModule mod_userdir.c>
UserDir public_html
Include /etc/apache2/mod_userdir.conf
</IfModule>


#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/srv/www/htdocs/zocker">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

</VirtualHost>



3. Conf:

#
# Global configuration that will be applicable for all virtual hosts, unless
# deleted here, or overriden elswhere.
#

DocumentRoot "/srv/www/htdocs"

#
# Configure the DocumentRoot
#
<Directory "/srv/www/htdocs">
# 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.0/mod/core.html#options
# for more information.
Options None
# 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>

# Aliases: aliases can be added as needed (with no limit). The format is
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
# We include the /icons/ alias for FancyIndexed directory listings. If you
# do not use FancyIndexing, you may comment this out.
#
Alias /icons/ "/usr/share/apache2/icons/"

<Directory "/usr/share/apache2/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

# 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/cgi-bin/"

# "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/srv/www/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>


# Include all *.conf files from /etc/apache2/conf.d/.
#
# This is mostly meant as a place for other RPM packages to drop in their
# configuration snippet.
#
# You can comment this out here if you want those bits include only in a
# certain virtual host, but not here.
#
Include /etc/apache2/conf.d/*.conf

# The manual... if it is installed ('?' means it won't complain)
Include /etc/apache2/conf.d/apache2-manual?conf





und nun noch die hosts Datei:

# Copyright (c) 1993-1999 Microsoft Corp.
#
# Dies ist eine HOSTS-Beispieldatei, die von Microsoft TCP/IP
# für Windows 2000 verwendet wird.
#
# Diese Datei enthält die Zuordnungen der IP-Adressen zu Hostnamen.
# Jeder Eintrag muss in einer eigenen Zeile stehen. Die IP-
# Adresse sollte in der ersten Spalte gefolgt vom zugehörigen
# Hostnamen stehen.
# Die IP-Adresse und der Hostname müssen durch mindestens ein
# Leerzeichen getrennt sein.
#
# Zusätzliche Kommentare (so wie in dieser Datei) können in
# einzelnen Zeilen oder hinter dem Computernamen eingefügt werden,
# aber müssen mit dem Zeichen '#' eingegeben werden.
#
# Zum Beispiel:
#
# 102.54.94.97 rhino.acme.com # Quellserver
# 38.25.63.10 x.acme.com # x-Clienthost
127.0.0.1 localhost

192.168.0.150 www.reifenservice-baer.de
192.168.0.150 www.callofdutyzocker.de
192.168.0.150 www.winterzocker.de

Vielen Dank nochmals an euch.
 

texus

Member
Bin kein großer Apache. :lol:
Aber solltest du nicht für deine 3. (winterzocker) Domain auch einen virtual Host anlegen ???

Mfg
texus
 
OP
M

mifroe

Newbie
@Texus die gibt es so eigentlich gar nicht ich wollte nur ausprobieren was der Server macht wenn er eine Anfrage bekommt mit der er nichts anstellen kann. Und aus meiner Sicht müßte dann eigentlich eine Fehlermeldung kommen und nicht irgendeine Webseite.
 

texus

Member
Ich würde es dennoch probieren. Warum das so ist ? Kein Plan. Wie gesagt habe eher wenig mit dem Indianer zu tun.

Könnte evtl auch daran liegen, dass deine Document Root der Virtual Hosts Unterverzeichnisse des Haupt Document Root sind.
Verlege doch mal die DRoots deiner virtual Hosts aus dem htdocs Verzeichnis heraus. (z.b /srv/vhost/ .....) und guck mal ob das Phänomen dann immer noch auftritt.

MfG
texus
 
OP
M

mifroe

Newbie
also ich habe jetzt die Dateien verschoben und die DocumentRoot in den vhosts angepasst. Leider besteht das Problem weiterhin.
 
OP
M

mifroe

Newbie
nein. Die soll es so ja auch nicht geben. Ich wollte mit dieser Adresse ja nur bewirken, dass er mir sagt dass er diese Adresse nicht findet.
 

texus

Member
???
Aber du hast ihm doch in der "Hosts" gesagt das es sie gibt.
Code:
192.168.0.150 www.winterzocker.de

Also löst er den Namen in die IP auf. Da es eine Http Anfrage ohne zusätzliche Portangabe ist wird der Standardport genommen.
Und was kommt raus?? 192.168.0.150:80 -> und die gibt es ja.
Und da wird er sich den ersten VH holen.

Nur mal so zum Spaß: Ändere doch mal deine Hosts Datei dahingahend, dass nicht reifen..... der erste Eintrag ist sondern callofduty...... . Und wenn du jetzt winterzocker eingibst ?
Bin mal auf die Antwort gespannt.
 
Oben