Virtualmin too easily defaults to "Any" Virtual Hosts

I'm not actually sure what's wrong in the default installation configuration on Ubuntu that causes this, but Virtualmin should really not default to "Any" IP virtual hosts unless explicitly told to do so (because it leads to virtual hosts not working with somewhat mysterious errors, and there's almost never a circumstance where it makes sense on a virtual hosting system).

So:

  • If no IP defined, use the system default IP in all virtual hosts, unless told otherwise when creating.
  • If IP address defined, use that IP in all virtual hosts, unless told otherwise when creating.
  • If specifically told to use Any, use Any. But, never otherwise. And, maybe warn about doing so, when explicitly told to do so.

Right now, it seems to fall back to Any in some circumstance where it really shouldn't. Again, I don't actually know why it's happening on my fresh ubuntu install, but it is...and even knowing as much as I do, I don't see how to fix it. I haven't told it to do this, so I don't know how to tell it to do the right thing. It definitely shouldn't be this way in a default install.

Status: 
Active

Comments

Joe's picture
Submitted by Joe on Thu, 12/29/2016 - 22:26 Pro Licensee

Assigned: Unassigned ยป

A simple fix for this may just be to remove the default Ubuntu/Debian VirtualHost definition upon installation, which is very trivial to do.

I've long since considered that, maybe it's time to add that. I can look into that.

Joe's picture
Submitted by Joe on Fri, 12/30/2016 - 03:04 Pro Licensee

I can't think of any reason for Virtualmin to follow the lead of the default VirtualHost. There's just no good reason for Virtualmin to do to that in the presence of a *:80 default VirtualHost. And, equally bad, there's no way to fix it within Virtualmin. You have to hit the command line or the Apache module to make it all work right...and, Virtualmin confusingly shows the right IP within Virtualmin, but the actual VirtualHosts have *:80 and don't work (it always tries to serve the "default" in such a case).

Joe's picture
Submitted by Joe on Fri, 12/30/2016 - 03:06 Pro Licensee

So, just because Virtualmin has always done it that way, and we've worked around it for all these years doesn't really mean we should keep doing it that way. I think it's just nicer to default to using an IP, unless told to do otherwise. Leaving the default site alone should be fine, and would reduce the amount of work that goes on in the install script (I have a vision of a Virtualmin that doesn't need a complicated install script).

Joe, are you saying that the issue is that Virtualmin creates Apache virtual hosts with *:80 instead of IP:80 in the Virtualhost block?