Limiting to the ServerName in Apache2

Posted by David on Server Fault See other posts from Server Fault or by David
Published on 2010-05-25T10:03:22Z Indexed on 2010/05/25 10:11 UTC
Read the original article Hit count: 189

Filed under:

I have 2 sites defined in my Apache2. Each one has a servername.

For example:

Server 1 (first in sites-enabled) responds to www.example.com
Server 2 (second in sites-enabled) responds to www.example2.com

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.

© Server Fault or respective owner

Related posts about apache