2

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.

2 Answers 2

1

Try using apache's default host option http://httpd.apache.org/docs/2.2/vhosts/examples.html#default

1
  • It is not working. It seems the first server is catching all petitions containing the IP. May 25, 2010 at 10:32
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .