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 2 sites defined in my Apache2. Each one has a servername.

For example:

Server 1 (first in sites-enabled) responds to
Server 2 (second in sites-enabled) responds to

Ok, the problem is when I type the server IP in the URL, the first server responds.

How could I limit the response to only specifying its servername? I would like to block the IP calls.

If that is not possible, I would like the second server to respond, not the first. I cannot change the order because there are aliases defined in the second server that would override the first server config.

share|improve this question

Try using apache's default host option

share|improve this answer
It is not working. It seems the first server is catching all petitions containing the IP. – David Morales May 25 '10 at 10:32
up vote 1 down vote accepted

Finally, I have the solution.

I just created a new virtual host, with the ServerName set to the server IP address.

Now every request to the server IP will be catched by the new virtual host.

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.