[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Lang] Name based VirtualHosts Merkwürdigkeiten



Hallo,

Nachdem sich mein pdns Problem gelöst habe, und ich nun versuche als 
webfrontend tupa zu instalieren, ein sehr junges aber ambitioniertes 
Projekt von Urs Weiss ( http://www.tupa-dns.org/ ), treten die 
Merkwürdigkeiten, wegen derer ich ja erst pdns installiert hatte weiter 
auf. 

Die Hälfte meiner Browser spinnt (Opera, firefox(32bit chroot), eLinks), 
die andere 'bessere' Hälfte ( wget, lynx, w3m, konqueror und 
merkwürdigerweise firefox(64bit)) machts richtig, und holt die Seite 
der VirtualHosts. 

Genau: Die die es richtig machen senden einen http1.1 request an 
172.16.240.1, und die die es falsch machen einen request an 127.0.0.1, 
doet sind keione vhosts definiertz, und der server fällt auf 
DokumentRoot /var/www des für localhost definierten server zurück, und 
zeigt daher die falsche Seite.

Die Hälfte der Browser löst also eine meiner drei im pdns angelegten 
lokalen "virtuellen domains" auf 127.0.0.1 an Stelle der richtigen 
172.16.240.1 auf (falls man das so überhaupt sagen kann, da der pdns ja 
die Namen auflöst, aber eben nach 172.16.240.1). 

$ nslookup www.mypages.home
Server:         127.0.0.1
Address:        127.0.0.1#53
$ dig www.mypages.home A @127.0.0.1 |grep A
; <<>> DiG 9.2.4 <<>> www.mypages.home A @127.0.0.1
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50897
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;www.mypages.home.              IN      A
;; ANSWER SECTION:
www.mypages.home.       120     IN      A       172.16.240.1

Name:   www.mypages.home
Address: 172.16.240.1
$ host www.mypages.home
www.mypages.home has address 172.16.240.1
$ ping www.mypages.home
PING www.mypages.home (172.16.240.1) 56(84) bytes of data.
64 bytes from 172.16.240.1: icmp_seq=1 ttl=64 time=0.020 ms
$ host www.linie-christina.home
www.linie-christina.home has address 172.16.240.1
$ ping www.linie-christina.home
PING www.linie-christina.home (172.16.240.1) 56(84) bytes of data.
64 bytes from 172.16.240.1: icmp_seq=1 ttl=64 time=0.020 ms
$ host www.kreissle.home
www.kreissle.home has address 172.16.240.1
$ ping www.kreissle.home
PING www.kreissle.home (172.16.240.1) 56(84) bytes of data.
64 bytes from 172.16.240.1: icmp_seq=1 ttl=64 time=0.025 ms


Sehr merkwürdig, und scheinbar selten, bei einer Suchanfrage über google 
bin ich nur auf eine Hand voll Leidensgenossen - ohne Lösung - gestoßen 
z.B.:
http://forums.devshed.com/t18835/s.html
<quote>
Thanks for the help...

I've now removed all the stuff for the vhosts from /etc/hosts.

an NSLOOKUP of my www.mydomain.com resolves to the correct ip address, a 
ping also goes to the correct ip address.

I've installed lynx on the webserver - from this machine I can access 
and browse the vhosts without a problem.

it appears that the DNS is set up correctly - as I can resolve the 
correct IP addresses.

It seems very bizarre.
</quote>

Leider findet sich dort keine Lösung des Problems. Dort wird auch 
gesagt, dass für NBVHosts CNAME reicht, aber A empfohlen wird, oder 
sollte es umgekehrt sein? 

$ grep -v ^# /etc/hosts
127.0.0.1       localhost
127.0.0.1       ubuntu  localhost
127.0.0.1       localhost.localdomain   localhost       ubuntu
127.0.0.1       ubuntu.workgroup.home   localhost       ubuntu

::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

$ grep -v ^# /etc/resolv.conf
nameserver 127.0.0.1
nameserver 62.104.191.241
nameserver 193.189.244.205

Die vhosts sind in der httpd.conf nach gleichem Schema angelegt.

NameVirtualHost 172.16.240.1:80
<VirtualHost ...>
...
</VirtualHost>
<VirtualHost 172.16.240.1:80>
    ServerAdmin webmaster@debian.home
    DocumentRoot /mnt/win_f/export/Projekte/kreissle.net/www
    ServerName www.kreissle.home
    ErrorLog logs/kreissle.debian.home-error.log
    CustomLog logs/kreissle.debian.home-access.log common
</VirtualHost>
<VirtualHost 172.16.240.1:80>
    ServerAdmin webmaster@debian.home
    DocumentRoot /mnt/win_f/export/Projekte/MyPages/test
    ServerName www.mypages.home
    ErrorLog logs/MyPages.home-error.log
    CustomLog logs/MyPages.home-access.log common
</VirtualHost>

Ich habe mich nun beholfen mit 
NameVirtualHost 127.0.0.1:80
NameVirtualHost 172.16.240.1:80
<VirtualHost 127.0.0.1:80 172.16.240.1:80>
    ServerAdmin webmaster@debian.home
    DocumentRoot /mnt/win_f/export/Projekte/MyPages/test
    ServerName www.mypages.home
    ErrorLog logs/MyPages.home-error.log
    CustomLog logs/MyPages.home-access.log common
</VirtualHost>

Aber das  ist ja auch keine Lösung des Verwirrspiels, jedenfalls weiß 
ich deshalb noch nicht weshalb das so ist.

Eine vielleicht entscheidende Idee:

Ich hatte mypages.home vorher so angelegt:
INSERT INTO `domains` VALUES 
(2,'MyPages.home',NULL,NULL,'NATIVE',NULL,NULL);
INSERT INTO `records` VALUES (11,1,'MyPages.home','SOA','localhost 
gginfo@web.de 1',86400,NULL,NULL,0);
INSERT INTO `records` VALUES 
(12,1,'MyPages.home','NS','dns-us1.powerdns.net',86400,NULL,NULL,0);
INSERT INTO `records` VALUES 
(13,1,'MyPages.home','NS','dns-eu1.powerdns.net',86400,NULL,NULL,0);
INSERT INTO `records` VALUES 
(14,1,'www.MyPages.home','A','172.16.240.1',120,NULL,NULL,0);
INSERT INTO `records` VALUES 
(15,1,'mail.MyPages.home','A','172.16.240.1',120,NULL,NULL,0);
INSERT INTO `records` VALUES 
(16,1,'localhost.MyPages.home','A','127.0.0.1',120,NULL,NULL,0);
INSERT INTO `records` VALUES 
(17,1,'MyPages.home','MX','mail.MyPages.home',120,25,NULL,0);
INSERT INTO `records` VALUES 
(25,1,'www.MyPages.home','CNAME','172.16.240.1',120,NULL,NULL,0);

Jetzt sind sehen sie so aus:
INSERT INTO `records` VALUES (11,1,'mypages.home','SOA','localhost 
gginfo@web.de 1',86400,NULL,NULL,0);
INSERT INTO `records` VALUES 
(12,1,'mypages.home','NS','dns-us1.powerdns.net',86400,NULL,NULL,0);
INSERT INTO `records` VALUES 
(13,1,'mypages.home','NS','dns-eu1.powerdns.net',86400,NULL,NULL,0);
INSERT INTO `records` VALUES 
(15,1,'mail.mypages.home','A','172.16.240.1',120,NULL,NULL,0);
INSERT INTO `records` VALUES 
(16,1,'localhost.mypages.home','A','127.0.0.1',120,NULL,NULL,0);
INSERT INTO `records` VALUES 
(17,1,'mypages.home','MX','mail.mypages.home',120,25,NULL,0);
INSERT INTO `records` VALUES 
(25,1,'www.mypages.home','A','172.16.240.1',120,NULL,NULL,0);
INSERT INTO `records` VALUES (26,1,'www.mypages.home','SOA','localhost 
gginfo@web.de 1',86400,NULL,NULL,0);

Vielleicht hatte ich ja auch einen falschen A record gesetzt, der eine 
ttl von 86400 statt 120 hatte, kann aber irgendwie auch nicht sein, da 
dann ja alle Browser falsch anfordern müssten. Falls das überhaupt 
solche Auswirkungen haben könnte (kenne mich mit DNS noch nicht so 
aus). Jedenfalls fehlte am Anfang der A record.

Cachen die Browser das sonst irgendwo? Ich habe die history und cache 
sowie entsprechende cookies (soweit ich das sehen konnte) gelöscht, bei 
Opera sogar alles was ich finden konnte.

Hat jemand vielleicht eine Idee?
Vorher mit der /etc/hosts hatte ich auch schon solche probleme, weshalb 
ich ja pdns installierte.

ciao

Gerhard



Reply to: