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

This documentation says that

Due to the fact that is first in the configuration file, 
it has the highest priority and can be seen as the default or primary server. 
That means that if a request is received that does not match one of the specified 
ServerName directives, it will be served by this first VirtualHost.

How can I disable this, I do not want apache to serve any files if any of the enabled virtual hosts do not match?

share|improve this question
up vote 7 down vote accepted

Just make your first <VirtualHost> one that says no to any request.

<VirtualHost *:80>
    ServerName i-dont-want-your-requests
    Order allow,deny
    Deny from all
share|improve this answer

To make use of the traffic anyways you could just mock up a page that tells the user that there is nothing to see here and he must have entered the wrong (sub)domain.
Maybe give some possible domains the user might have been looking for or just display some ads.

Would be a shame to let traffic go to waste, not to mention the difference such a page would make in user-friendliness as opposed to a simple "Access Denied" Page.

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.