Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

We are running Apache on a server with multiple VirtualHost entries. Whenever someone access the server by it's IP address (http://198.147.xx.xx), one of the websites that is a VirtualHost comes up. This is not desired. We would rather a blank page come up if the IP is accessed directly. I'm not sure if the chosen site is just the first one that comes in the list of Virtual Host entries or what.

We want to setup a default, blank page if someone access the server by IP. I thought that simply setting up another VirtualHost entry for the IP address would do it, and it seemed to, but now accessing any of the other VirtualHost sites leads to the same blank, default page. Here is an example of our config:

<VirtualHost *:80>
    DocumentRoot /vhosts/
    <Directory "/vhosts/">
        allow from all
        Options +Indexes
        AllowOverride All

<VirtualHost 198.147.XX.XX:80>
    DocumentRoot /vhosts/default/public
    <Directory /vhosts/default/public>
        allow from all
        Options +Indexes

What are we doing wrong here? Is there a better way to setup a default landing page for anyone accessing the server via IP address?

share|improve this question

If I remember right, the behavior for virtual hosts works like so:

  • httpd searches for the vhost with the most specific qualifiers. (either IP address, or the host header if NameVirtualHost has been declared)
  • In the absence of a specific entry, the first virtual host to be defined gets used. This is called the default virtual host and what normally gets served when a request is made without a Host header. (i.e. by IP address)

The problem you're running into now is that your IP based virtual host is more specific than your catch-all, default virtual host (at least when the Host header doesn't match the ServerName or ServerAlias). To get the behavior you're looking for, I think you'd need to do this:

  • Create a default virtualhost of *:80 with a blank page.
  • Adjust your virtualhost so that its ServerAlias contains every name that you don't want hitting the default virtual host.

Hopefully someone has a solution that comes closer to achieving your desired end result; it's been awhile and I'd be interested to learn from it.

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.