no default website

Hello,

might be a stupid question, but i installed virtualmin and the first site i see was "It works" site. (default?)

Now i`ve 4 sites and when i type the server ip i see my first website.
I thought it would be still default website!?

If i type abc.com /home/abc/ should be home directory but if a wrong name not listed in host alias or name is typed it should direct to default site (like "It works"). Or better it didn`t work because there is no such name on this server (or acces denied or something).
Same for the IP

How can i do this??

thanks

on a clean install, apache is at /var/www/html (on a centos system)
as soon as you create a domain then Apache looks at the first entry in the httpd.conf in the <virtualhost> directive (which is at /home/domain/)

whichever <virtualhost> is first, it will show that when a wrong url is typed in.

You can manually move a preferred domain to the top or a create a dummy domain if you prefer and move that to the top of that directive.

To add to ronald’s (correct) explanation:

Apache has two modes of operation…one website (a “default”, if you like), or virtual hosting with many websites. When Apache is configured for name-based virtual hosting, it no longer has a “default” website…it has a “first best match” website, which means the first website listed in its configuration that matches the IP you’ve connected on.

So, this is the “logic” behind what ronald has explained. It’s just such a common misunderstanding about Apache, that I thought it worth expanding on. It’s easiest to just assume that Apache has no such thing as a “default” website…because, in a real world virtual hosting environment, it doesn’t.