Problem mit virtuellen Hosts zu konfigurieren
-
05-09-2019 - |
Frage
Einige Details
- XAMPP 1.7.1
- OS getestet auf Vista und XP
Hallo an alle. Ich habe einige Probleme mit meinem virtuellen Hosts zu konfigurieren. Ich habe zur Zeit zwei Seiten.
Hier ist meine vhost.conf-Datei:
<VirtualHost *:80>
ServerAdmin me@site.nl
DocumentRoot c:/xampp/htdocs/site1/trunk/
ServerName site1.local
</VirtualHost>
<VirtualHost *:80>
ServerAdmin me@site.nl
DocumentRoot c:/xampp/htdocs/site2/trunk/
ServerName site2.local
</VirtualHost>
Und natürlich in meiner Host-Datei Ich habe
127.0.0.1 site1.local
127.0.0.1 site2.local
Ich habe Apache sowie meinen Browser verschiedene Zeiten neu gestartet.
Hier ist mein Problem:
http: //site1.local funktioniert. Aber wenn ich gehe zu http:. //Site2.local , ich site1.local landen
irgendeine Idee?
Lösung
Versuchen
<VirtualHost "site1.local">
ServerAdmin spam@a1230912##ad#.nl
DocumentRoot c:/xampp/htdocs/site1/trunk/
ServerName site1.local
</VirtualHost>
<VirtualHost "site2.local">
ServerAdmin spam@a1230912##ad#.nl
DocumentRoot c:/xampp/htdocs/site2/trunk/
ServerName site2.local
</VirtualHost>
Sie erhalten immer site1 weil Apache standardmäßig auf den ersten.
Bearbeiten
Kommentar-
#NameVirtualHost *
NameVirtualHost *
In der httpd.conf
Minen sagt (/etc/httpd/conf/httpd.conf)
126 # Listen: Allows you to bind Apache to specific IP addresses and/or
127 # ports, in addition to the default. See also the <VirtualHost>
128 # directive.
129 #
130 # Change this to Listen on specific IP addresses as shown below to
131 # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
132 #
133 Listen 127.0.0.1:80
134 NameVirtualHost 127.0.0.1
Und meine vhost-Datei hat
<VirtualHost "www.whatever.com">
DocumentRoot /var/www/html/whatever/pub
ErrorLog logs/error_log
ServerName www.whatever.com
...
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow