This is the intended behavior. If you use the IP (let's say http://123.123.123.123/
), Apache will use 123.123.123.123
as HTTP the hostname. Since there is no VirtualHost with a ServerName
or ServerAlias
of 123.123.123.123
, the first VirtualHost is used.
So if you want a VirtualHost that listens only for http://123.123.123.123/
you can simply create a VirtualHost with:
<VirtualHost *:80>
DocumentRoot /var/www/html/my-ip-site/
ServerName 123.123.123.123
</VirtualHost>