How do I prevent Apache from answering requests for domains I don't host?

Solution 1:

You should put your actual web site in an Apache <VirtualHost> block, and have the default host serve only the Apache test page.

If you are using name-based virtual hosts, like most people, then just ensure that the default virtual host appears first in your configuration. You can check your configuration with a command such as httpd -S.

See also Apache's examples for more information.