Comment utiliser 2 IP sur un server Apache

J'ai deux IP (et domaines) sur mon server Linux dédié (Debian). Je peux accéder au domaine principal. Mais lorsque j'essaie d'accéder à la 2ème, je suis dirigé vers le site principal.

Dans /etc/network/interfaces , j'ai ceci:

 auto eth0 iface eth0 inet static address 192.99.233.101 netmask 255.255.255.0 network 192.99.233.0 broadcast 192.99.233.255 gateway 192.99.233.254 auto eth0:0 iface eth0:0 inet static address 149.56.155.72 netmask 255.255.255.255 post-up /sbin/ifconfig eth0:0 149.56.155.72 netmask 255.255.255.255 broadcast 149.56.155.72 pre-down /sbin/ifconfig eth0:0 down auto eth0 auto eth0 iface eth0 inet static address 192.99.233.101 netmask 255.255.255.0 network 192.99.233.0 broadcast 192.99.233.255 gateway 192.99.233.254 auto eth0:0 iface eth0:0 inet static address 149.56.155.72 netmask 255.255.255.255 post-up /sbin/ifconfig eth0:0 149.56.155.72 netmask 255.255.255.255 broadcast 149.56.155.72 pre-down /sbin/ifconfig eth0:0 down iface eth0 inet static auto eth0 iface eth0 inet static address 192.99.233.101 netmask 255.255.255.0 network 192.99.233.0 broadcast 192.99.233.255 gateway 192.99.233.254 auto eth0:0 iface eth0:0 inet static address 149.56.155.72 netmask 255.255.255.255 post-up /sbin/ifconfig eth0:0 149.56.155.72 netmask 255.255.255.255 broadcast 149.56.155.72 pre-down /sbin/ifconfig eth0:0 down adresse 192.99.233.101 auto eth0 iface eth0 inet static address 192.99.233.101 netmask 255.255.255.0 network 192.99.233.0 broadcast 192.99.233.255 gateway 192.99.233.254 auto eth0:0 iface eth0:0 inet static address 149.56.155.72 netmask 255.255.255.255 post-up /sbin/ifconfig eth0:0 149.56.155.72 netmask 255.255.255.255 broadcast 149.56.155.72 pre-down /sbin/ifconfig eth0:0 down netmask 255.255.255.0 auto eth0 iface eth0 inet static address 192.99.233.101 netmask 255.255.255.0 network 192.99.233.0 broadcast 192.99.233.255 gateway 192.99.233.254 auto eth0:0 iface eth0:0 inet static address 149.56.155.72 netmask 255.255.255.255 post-up /sbin/ifconfig eth0:0 149.56.155.72 netmask 255.255.255.255 broadcast 149.56.155.72 pre-down /sbin/ifconfig eth0:0 down réseau 192.99.233.0 auto eth0 iface eth0 inet static address 192.99.233.101 netmask 255.255.255.0 network 192.99.233.0 broadcast 192.99.233.255 gateway 192.99.233.254 auto eth0:0 iface eth0:0 inet static address 149.56.155.72 netmask 255.255.255.255 post-up /sbin/ifconfig eth0:0 149.56.155.72 netmask 255.255.255.255 broadcast 149.56.155.72 pre-down /sbin/ifconfig eth0:0 down diffusion 192.99.233.255 auto eth0 iface eth0 inet static address 192.99.233.101 netmask 255.255.255.0 network 192.99.233.0 broadcast 192.99.233.255 gateway 192.99.233.254 auto eth0:0 iface eth0:0 inet static address 149.56.155.72 netmask 255.255.255.255 post-up /sbin/ifconfig eth0:0 149.56.155.72 netmask 255.255.255.255 broadcast 149.56.155.72 pre-down /sbin/ifconfig eth0:0 down passerelle 192.99.233.254 auto eth0 iface eth0 inet static address 192.99.233.101 netmask 255.255.255.0 network 192.99.233.0 broadcast 192.99.233.255 gateway 192.99.233.254 auto eth0:0 iface eth0:0 inet static address 149.56.155.72 netmask 255.255.255.255 post-up /sbin/ifconfig eth0:0 149.56.155.72 netmask 255.255.255.255 broadcast 149.56.155.72 pre-down /sbin/ifconfig eth0:0 down adresse 149.56.155.72 auto eth0 iface eth0 inet static address 192.99.233.101 netmask 255.255.255.0 network 192.99.233.0 broadcast 192.99.233.255 gateway 192.99.233.254 auto eth0:0 iface eth0:0 inet static address 149.56.155.72 netmask 255.255.255.255 post-up /sbin/ifconfig eth0:0 149.56.155.72 netmask 255.255.255.255 broadcast 149.56.155.72 pre-down /sbin/ifconfig eth0:0 down masque de réseau 255.255.255.255 auto eth0 iface eth0 inet static address 192.99.233.101 netmask 255.255.255.0 network 192.99.233.0 broadcast 192.99.233.255 gateway 192.99.233.254 auto eth0:0 iface eth0:0 inet static address 149.56.155.72 netmask 255.255.255.255 post-up /sbin/ifconfig eth0:0 149.56.155.72 netmask 255.255.255.255 broadcast 149.56.155.72 pre-down /sbin/ifconfig eth0:0 down post-up / sbin / ifconfig eth0: 0 149.56.155.72 netmask 255.255.255.255 émission 149.56.155.72 auto eth0 iface eth0 inet static address 192.99.233.101 netmask 255.255.255.0 network 192.99.233.0 broadcast 192.99.233.255 gateway 192.99.233.254 auto eth0:0 iface eth0:0 inet static address 149.56.155.72 netmask 255.255.255.255 post-up /sbin/ifconfig eth0:0 149.56.155.72 netmask 255.255.255.255 broadcast 149.56.155.72 pre-down /sbin/ifconfig eth0:0 down 

J'ai redémarré le réseau: /etc/init.d/networking restart

Ensuite, j'ai créé deux nouveaux files .conf dans /etc/apache2/sites-available , un pour chaque domaine.

site1.conf: mis à jour

 <VirtualHost 192.99.233.101:80> ServerAdmin webmaster@localhost Servername site1.net ServerAlias www.site1.net DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> <VirtualHost 192.99.233.101:80> <VirtualHost 192.99.233.101:80> ServerAdmin webmaster@localhost Servername site1.net ServerAlias www.site1.net DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> ServerAdmin webmaster @ localhost <VirtualHost 192.99.233.101:80> ServerAdmin webmaster@localhost Servername site1.net ServerAlias www.site1.net DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> Servername site1.net <VirtualHost 192.99.233.101:80> ServerAdmin webmaster@localhost Servername site1.net ServerAlias www.site1.net DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> ServerAlias ​​www.site1.net <VirtualHost 192.99.233.101:80> ServerAdmin webmaster@localhost Servername site1.net ServerAlias www.site1.net DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> ErrorLog $ {APACHE_LOG_DIR} /error.log <VirtualHost 192.99.233.101:80> ServerAdmin webmaster@localhost Servername site1.net ServerAlias www.site1.net DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> CustomLog $ {APACHE_LOG_DIR} /access.log combiné <VirtualHost 192.99.233.101:80> ServerAdmin webmaster@localhost Servername site1.net ServerAlias www.site1.net DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> 

site2.conf:

 <VirtualHost 149.56.155.72:80> ServerAdmin admin@site2.co ServerName site2.co ServerAlias www.site2.co DocumentRoot /var/www/html1 ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> <VirtualHost 149.56.155.72:80> <VirtualHost 149.56.155.72:80> ServerAdmin admin@site2.co ServerName site2.co ServerAlias www.site2.co DocumentRoot /var/www/html1 ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> ServerAdmin admin@site2.co <VirtualHost 149.56.155.72:80> ServerAdmin admin@site2.co ServerName site2.co ServerAlias www.site2.co DocumentRoot /var/www/html1 ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> ServerName site2.co <VirtualHost 149.56.155.72:80> ServerAdmin admin@site2.co ServerName site2.co ServerAlias www.site2.co DocumentRoot /var/www/html1 ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> ServerAlias ​​www.site2.co <VirtualHost 149.56.155.72:80> ServerAdmin admin@site2.co ServerName site2.co ServerAlias www.site2.co DocumentRoot /var/www/html1 ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> DocumentRoot / var / www / html1 <VirtualHost 149.56.155.72:80> ServerAdmin admin@site2.co ServerName site2.co ServerAlias www.site2.co DocumentRoot /var/www/html1 ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> ErrorLog $ {APACHE_LOG_DIR} /error.log <VirtualHost 149.56.155.72:80> ServerAdmin admin@site2.co ServerName site2.co ServerAlias www.site2.co DocumentRoot /var/www/html1 ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> CustomLog $ {APACHE_LOG_DIR} /access.log combiné <VirtualHost 149.56.155.72:80> ServerAdmin admin@site2.co ServerName site2.co ServerAlias www.site2.co DocumentRoot /var/www/html1 ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> 

Puis j'ai couru ces trois cmds:

 `a2dissite 000-default.conf` `a2ensite site1.conf` `a2ensite site2.conf` `a2dissite 000-default.conf` `a2dissite 000-default.conf` `a2ensite site1.conf` `a2ensite site2.conf` `a2ensite site1.conf` `a2dissite 000-default.conf` `a2ensite site1.conf` `a2ensite site2.conf` 

et enfin, j'ai redémarré Apache. Et je continue d'get le site1 chaque fois que j'essaie de générer le site2. J'ai fait les rdns pour le site2 et tout ce qu'il y a de bien.

C'est ma première tentative de faire quelque chose comme ça. Est-ce que quelqu'un peut voir ce que je ne fais pas … ou que plus faut-il faire? Merci.

METTRE À JOUR:

 root@dfwit:~# apachectl -t -D DUMP_VHOSTS AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using site2.co. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: *:443 site2.co (/etc/apache2/sites-enabled/default-ssl.conf:2) *:80 is a NameVirtualHost default server site2.co (/etc/apache2/sites-enabled/site2.conf:1) port 80 namevhost site2.co (/etc/apache2/sites-enabled/site2.conf:1) alias www.site2.co port 80 namevhost site1.net (/etc/apache2/sites-enabled/site1.conf:1) alias www.site1.net root@dfwit:~# root @ dfwit: ~ # apachectl -t -D DUMP_VHOSTS root@dfwit:~# apachectl -t -D DUMP_VHOSTS AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using site2.co. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: *:443 site2.co (/etc/apache2/sites-enabled/default-ssl.conf:2) *:80 is a NameVirtualHost default server site2.co (/etc/apache2/sites-enabled/site2.conf:1) port 80 namevhost site2.co (/etc/apache2/sites-enabled/site2.conf:1) alias www.site2.co port 80 namevhost site1.net (/etc/apache2/sites-enabled/site1.conf:1) alias www.site1.net root@dfwit:~# AH00558: apache2: Impossible de déterminer de manière fiable le nom de domaine complet du server, en utilisant site2.co. root@dfwit:~# apachectl -t -D DUMP_VHOSTS AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using site2.co. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: *:443 site2.co (/etc/apache2/sites-enabled/default-ssl.conf:2) *:80 is a NameVirtualHost default server site2.co (/etc/apache2/sites-enabled/site2.conf:1) port 80 namevhost site2.co (/etc/apache2/sites-enabled/site2.conf:1) alias www.site2.co port 80 namevhost site1.net (/etc/apache2/sites-enabled/site1.conf:1) alias www.site1.net root@dfwit:~# Configuration de VirtualHost: root@dfwit:~# apachectl -t -D DUMP_VHOSTS AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using site2.co. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: *:443 site2.co (/etc/apache2/sites-enabled/default-ssl.conf:2) *:80 is a NameVirtualHost default server site2.co (/etc/apache2/sites-enabled/site2.conf:1) port 80 namevhost site2.co (/etc/apache2/sites-enabled/site2.conf:1) alias www.site2.co port 80 namevhost site1.net (/etc/apache2/sites-enabled/site1.conf:1) alias www.site1.net root@dfwit:~# *: 443 site2.co (/etc/apache2/sites-enabled/default-ssl.conf:2) root@dfwit:~# apachectl -t -D DUMP_VHOSTS AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using site2.co. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: *:443 site2.co (/etc/apache2/sites-enabled/default-ssl.conf:2) *:80 is a NameVirtualHost default server site2.co (/etc/apache2/sites-enabled/site2.conf:1) port 80 namevhost site2.co (/etc/apache2/sites-enabled/site2.conf:1) alias www.site2.co port 80 namevhost site1.net (/etc/apache2/sites-enabled/site1.conf:1) alias www.site1.net root@dfwit:~# *: 80 est un NameVirtualHost root@dfwit:~# apachectl -t -D DUMP_VHOSTS AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using site2.co. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: *:443 site2.co (/etc/apache2/sites-enabled/default-ssl.conf:2) *:80 is a NameVirtualHost default server site2.co (/etc/apache2/sites-enabled/site2.conf:1) port 80 namevhost site2.co (/etc/apache2/sites-enabled/site2.conf:1) alias www.site2.co port 80 namevhost site1.net (/etc/apache2/sites-enabled/site1.conf:1) alias www.site1.net root@dfwit:~# server par défaut server2.co (/etc/apache2/sites-enabled/site2.conf:1) root@dfwit:~# apachectl -t -D DUMP_VHOSTS AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using site2.co. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: *:443 site2.co (/etc/apache2/sites-enabled/default-ssl.conf:2) *:80 is a NameVirtualHost default server site2.co (/etc/apache2/sites-enabled/site2.conf:1) port 80 namevhost site2.co (/etc/apache2/sites-enabled/site2.conf:1) alias www.site2.co port 80 namevhost site1.net (/etc/apache2/sites-enabled/site1.conf:1) alias www.site1.net root@dfwit:~# port 80 namevhost site2.co (/etc/apache2/sites-enabled/site2.conf:1) root@dfwit:~# apachectl -t -D DUMP_VHOSTS AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using site2.co. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: *:443 site2.co (/etc/apache2/sites-enabled/default-ssl.conf:2) *:80 is a NameVirtualHost default server site2.co (/etc/apache2/sites-enabled/site2.conf:1) port 80 namevhost site2.co (/etc/apache2/sites-enabled/site2.conf:1) alias www.site2.co port 80 namevhost site1.net (/etc/apache2/sites-enabled/site1.conf:1) alias www.site1.net root@dfwit:~# alias www.site2.co root@dfwit:~# apachectl -t -D DUMP_VHOSTS AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using site2.co. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: *:443 site2.co (/etc/apache2/sites-enabled/default-ssl.conf:2) *:80 is a NameVirtualHost default server site2.co (/etc/apache2/sites-enabled/site2.conf:1) port 80 namevhost site2.co (/etc/apache2/sites-enabled/site2.conf:1) alias www.site2.co port 80 namevhost site1.net (/etc/apache2/sites-enabled/site1.conf:1) alias www.site1.net root@dfwit:~# port 80 namevhost site1.net (/etc/apache2/sites-enabled/site1.conf:1) root@dfwit:~# apachectl -t -D DUMP_VHOSTS AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using site2.co. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: *:443 site2.co (/etc/apache2/sites-enabled/default-ssl.conf:2) *:80 is a NameVirtualHost default server site2.co (/etc/apache2/sites-enabled/site2.conf:1) port 80 namevhost site2.co (/etc/apache2/sites-enabled/site2.conf:1) alias www.site2.co port 80 namevhost site1.net (/etc/apache2/sites-enabled/site1.conf:1) alias www.site1.net root@dfwit:~# alias www.site1.net root@dfwit:~# apachectl -t -D DUMP_VHOSTS AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using site2.co. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: *:443 site2.co (/etc/apache2/sites-enabled/default-ssl.conf:2) *:80 is a NameVirtualHost default server site2.co (/etc/apache2/sites-enabled/site2.conf:1) port 80 namevhost site2.co (/etc/apache2/sites-enabled/site2.conf:1) alias www.site2.co port 80 namevhost site1.net (/etc/apache2/sites-enabled/site1.conf:1) alias www.site1.net root@dfwit:~# 

Est-ce que cela semble correct?

Une autre mise à jour

 root@dfwit:~# getent hosts 127.0.0.1 localhost.localdomain localhost 192.99.233.101 xtremeirc.net xtremeirc.net 149.56.155.72 dfwit.co dfwit.co 127.0.0.1 ip6-localhost ip6-loopback root@dfwit:~# root @ dfwit: ~ # getent hosts root@dfwit:~# getent hosts 127.0.0.1 localhost.localdomain localhost 192.99.233.101 xtremeirc.net xtremeirc.net 149.56.155.72 dfwit.co dfwit.co 127.0.0.1 ip6-localhost ip6-loopback root@dfwit:~# 127.0.0.1 localhost.localdomain localhost root@dfwit:~# getent hosts 127.0.0.1 localhost.localdomain localhost 192.99.233.101 xtremeirc.net xtremeirc.net 149.56.155.72 dfwit.co dfwit.co 127.0.0.1 ip6-localhost ip6-loopback root@dfwit:~# 192.99.233.101 xtremeirc.net xtremeirc.net root@dfwit:~# getent hosts 127.0.0.1 localhost.localdomain localhost 192.99.233.101 xtremeirc.net xtremeirc.net 149.56.155.72 dfwit.co dfwit.co 127.0.0.1 ip6-localhost ip6-loopback root@dfwit:~# 149.56.155.72 dfwit.co dfwit.co root@dfwit:~# getent hosts 127.0.0.1 localhost.localdomain localhost 192.99.233.101 xtremeirc.net xtremeirc.net 149.56.155.72 dfwit.co dfwit.co 127.0.0.1 ip6-localhost ip6-loopback root@dfwit:~# 127.0.0.1 ip6-localhost ip6-loopback root@dfwit:~# getent hosts 127.0.0.1 localhost.localdomain localhost 192.99.233.101 xtremeirc.net xtremeirc.net 149.56.155.72 dfwit.co dfwit.co 127.0.0.1 ip6-localhost ip6-loopback root@dfwit:~# 

Et voici les résultats du ping :

 root@dfwit:~# ping xtremeirc.net PING xtremeirc.net (192.99.233.101) 56(84) bytes of data. 64 bytes from xtremeirc.net (192.99.233.101): icmp_seq=1 ttl=64 time=0.040 ms root@dfwit:~# ping dfwit.co PING dfwit.co (149.56.155.72) 56(84) bytes of data. 64 bytes from dfwit.co (149.56.155.72): icmp_seq=1 ttl=64 time=0.046 ms root @ dfwit: ~ # ping xtremeirc.net root@dfwit:~# ping xtremeirc.net PING xtremeirc.net (192.99.233.101) 56(84) bytes of data. 64 bytes from xtremeirc.net (192.99.233.101): icmp_seq=1 ttl=64 time=0.040 ms root@dfwit:~# ping dfwit.co PING dfwit.co (149.56.155.72) 56(84) bytes of data. 64 bytes from dfwit.co (149.56.155.72): icmp_seq=1 ttl=64 time=0.046 ms PING xtremeirc.net (192.99.233.101) 56 (84) octets de données. root@dfwit:~# ping xtremeirc.net PING xtremeirc.net (192.99.233.101) 56(84) bytes of data. 64 bytes from xtremeirc.net (192.99.233.101): icmp_seq=1 ttl=64 time=0.040 ms root@dfwit:~# ping dfwit.co PING dfwit.co (149.56.155.72) 56(84) bytes of data. 64 bytes from dfwit.co (149.56.155.72): icmp_seq=1 ttl=64 time=0.046 ms 64 octets de xtremeirc.net (192.99.233.101): icmp_seq = 1 ttl = 64 fois = 0.040 ms root@dfwit:~# ping xtremeirc.net PING xtremeirc.net (192.99.233.101) 56(84) bytes of data. 64 bytes from xtremeirc.net (192.99.233.101): icmp_seq=1 ttl=64 time=0.040 ms root@dfwit:~# ping dfwit.co PING dfwit.co (149.56.155.72) 56(84) bytes of data. 64 bytes from dfwit.co (149.56.155.72): icmp_seq=1 ttl=64 time=0.046 ms root @ dfwit: ~ # ping dfwit.co root@dfwit:~# ping xtremeirc.net PING xtremeirc.net (192.99.233.101) 56(84) bytes of data. 64 bytes from xtremeirc.net (192.99.233.101): icmp_seq=1 ttl=64 time=0.040 ms root@dfwit:~# ping dfwit.co PING dfwit.co (149.56.155.72) 56(84) bytes of data. 64 bytes from dfwit.co (149.56.155.72): icmp_seq=1 ttl=64 time=0.046 ms PING dfwit.co (149.56.155.72) 56 (84) octets de données. root@dfwit:~# ping xtremeirc.net PING xtremeirc.net (192.99.233.101) 56(84) bytes of data. 64 bytes from xtremeirc.net (192.99.233.101): icmp_seq=1 ttl=64 time=0.040 ms root@dfwit:~# ping dfwit.co PING dfwit.co (149.56.155.72) 56(84) bytes of data. 64 bytes from dfwit.co (149.56.155.72): icmp_seq=1 ttl=64 time=0.046 ms 

Donc, le DNS semble se résoudre correctement. Mais le site1 est toujours chargé pour le site2.

Vous devez faire correspondre les inputs DNS. Il semble que les deux sites puissent résoudre la même IP. Le premier VHOST défini sur chaque adresse IP sera le site par défaut et gérera tous les sites qui ne résolvent pas.

Si vous souhaitez utiliser des domaines basés sur IP, vous devez associer votre configuration DNS. Vérifiez les résultats des host et / ou getent hosts pour voir quelle est votre configuration DNS.

Si vous utilisez les adresses IP comme vous l'indiquez, je m'attends à ce que chaque combinaison d'IP apparaisse comme une input NameVirtualHost distincte. Avant Apache 2.4, il y avait une directive NameVirtualHost qui pourrait être utilisée pour spécifier les combinaisons de VirtualHost IP / Port. Si vous utilisez Apache 2.2, essayez d'append des directives correspondantes NameVirtualHost avant les spécifications VirtualHost. Vous devrez peut-être supprimer la directive actuelle NameVirtualHost *: 80.

Vous pouvez utiliser le journal d'access pour le debugging. L'ajout de l'adresse locale ( %A ) au journal avec le site et le port ( %v:%p ) vous permettra de s'assurer que le trafic coule sur les adresses IP correctes. Pour un script CGI, SERVER_ADDR contient l'adresse IP locale pour la connection.

Généralement, vous devez définir un ServerName pour chaque vhost, et ServerAlias au besoin. Vous ne devez probablement pas cibler explicitement une adresse IP dans vos configurations vhost. Essayez simplement <VirtualHost *:80> pour les deux.

Auparavant, regardez la sortie de apachectl -t -D DUMP_VHOSTS cela vous dira si vos vhosts sont réellement configurés comme vous le pensez.