Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

For example:

all domain sharing same ip address

but when i directly type the public ip address, the browser will display

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

share|improve this question
up vote 2 down vote accepted

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/
   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
share|improve this answer

In the absence of an explicit IP-based virtual host...

<VirtualHost ipaddress:80>
 DocumentRoot /srv/www/bare-ip/

It'll pick the first virtual-host that matches the IP address wild-card:

<VirtualHost *:80>

This gives you your answer, you need an IP-based virtual host declaration to give an explicit web-directory for a bare IP request.

share|improve this answer
let me test it .. – hkguile Dec 24 '12 at 5:49

This is standard behavior. Apache matches the first (default) site if no sites match. I setup a default domain to handle cases like this as well as invalid (unconfigured) domains.

To support multiple domains by IP address, you will need multiple IP addresses. This also usually the case if you want to support multiple domains over SSL. There are some workarounds for SSL.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.