I have to admin a web server with Apache 2 to deliver some different websites - every site has its own domain. The server has a single IP address, say: 18.104.22.168. For every site a VirtualHost is defined like this:
<VirtualHost *:80> ServerName mydomain.com ServerAlias *.mydomain.com .... </VirtualHost>
It works fine, but there is a configuration problem: If someone tries to access the server via its IP address (http://22.214.171.124), the first VirtualHost is delivered - which I don't want. Instead, the access should be blocked or a special website should be served (to render some kind of error message). The server should only deliver sites by domain names.
How can I define a VirtualHost which is used for IP based access?