Any non-existant subdomain shows main website

Hi. I’m using Webmin 1.999, Virtualmin 7.1-1 in Ubuntu 18.04.6 in VPS (apache, mysql etc.). I have few top level virtual servers. For example:

  • Virtual server domainA[dot]com
  • Virtual server domainB[dot]com
  • Virtual server domainC[dot]com
    etc.

It all works fine for existing domains. But if I try to visit non-existant subdomain of any previously mentioned domain, for example sub.domainC[dot]com, othersub.domainB[dot]com or even something.domainA[dot]com, server always shows domainA[dot]com website content in that subdomain.

Any ideas what needs to be changed to get rid of that behaviour? If subdomain is not defined, it should not show any other website content.

Thanks for help!
P.S. sorry for those [dot] things - forum does not allow links use for new forum users.

Apache always serves what it thinks is the closest match, or if nothing matches, it serves the first VirtualHost configured that is on the right IP:port combo.

So, you can tell Virtualmin which one of your domains you want to be the “default” (that’s not really what’s happening, but it is close enough and we can’t think of any reasonable way to describe what Apache is actually doing in few enough words to put in the GUI). To do that, select the domain you want to be the “default”, and browse to System Settings->Website Options and set Default website for IP address to Yes. This, obviously, will make the current “default” website no longer the default.

Also, if you enter “default website” into the search box in the left-hand menu, it’ll show you this option and the page it appears on. (But, I guess you’d need to know that you’re looking for how to set a default address.)

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.