Default website of a web server by viewing by ip address

apache-2.2domain-name-system

i have a centos + webmin + virtualmin installed. The web server is hosting multiple website.

For example:
domainA.myftp.org
domainB.myftp.org
domainC.myftp.org

all domain sharing same ip address

but when i directly type the public ip address 123.123.123.123, the browser will display domainA.myftp.org

where can i set the website directory of an ip address? It this a dns or Apache virtual host or other issue? anyone knows?

Best Answer

As BillThor mentioned, the first host will be the default if nothing matches. And to override that and use a host other than the first, you can enter the ip address on the apache ServerAlias line, something like this:

# Use name-based virtual hosting.
#
NameVirtualHost *


<VirtualHost *>
    DocumentRoot /var/www/
   ServerName myhost.com
   ServerAlias 10.20.30.40
   ErrorLog logs/my-error_log
   CustomLog logs/my-access_log common
<Directory /var/www/>
    AllowOverride All
    Order allow,deny
    Options -Indexes FollowSymLinks ExecCGI
    Allow from all
</Directory>
</VirtualHost>