Que vhost foi apontado por ip addres quando ligou dois ou mais vhosts a um ip?

0

A configuração liga dois nomes de domínio

www1.example.com
www2.example.org

para o endereço IP 172.20.30.40 .

<VirtualHost 172.20.30.40:80>
    ServerAdmin [email protected]
    DocumentRoot "/www/vhosts/www1"
    ServerName www1.example.com
    ErrorLog "/www/logs/www1/error_log"
    CustomLog "/www/logs/www1/access_log" combined
</VirtualHost>

<VirtualHost 172.20.30.40:80>
    ServerAdmin [email protected]
    DocumentRoot "/www/vhosts/www2"
    ServerName www2.example.org
    ErrorLog "/www/logs/www2/error_log"
    CustomLog "/www/logs/www2/access_log" combined
</VirtualHost>

Meu enigma é: e se eu digitar 172.20.30.50:80 , qual página do domínio será exibida pelo apache?
www1.example.com ou www1.example.com ?

    
por scrapy 17.09.2018 / 04:21

1 resposta

0

Na documentação do Suporte ao host virtual baseado em nome do Apache:

Name-based virtual host resolution only chooses the most appropriate name-based virtual host after narrowing down the candidates to the best IP-based match. […]

When a request arrives, the server will find the best (most specific) matching argument based on the IP address and port used by the request. […]

The default name-based vhost for an IP and port combination

If no matching ServerName or ServerAlias is found in the set of virtual hosts containing the most specific matching IP address and port combination, then the first listed virtual host that matches that will be used.

    
por 17.09.2018 / 06:25