Adding a new sub-server overrides all other sub-servers


I have a Virtualmin server with numerous sub-servers. Today when I added a new sub-server on a sub-domain, all other sub-servers started displaying the content from the newly added sub-server (when viewed in a browser). I needed to delete the sub-server to restore the other sites.

Re-adding the sub server had the same effect.

Can anyone walk me through why this is suddenly happening? I regularly add new sub-servers to this account. Any ideas on how I can diagnose and fix this?



Hmm, I have a suspicion that you’re seeing this issue here:

Try the troubleshooting steps in there, and see if that helps with the issue you’re seeing.

Note that you may want to try that after adding in the Sub Server (it’ll take you through reviewing the IP address that’s in the Apache config files to make sure they’re all aligned).


Thanks, I will try these steps. It’s a production server so it’s definitely alarming when all hosted sites start going to the empty server I just added.


That being the case, it certainly can’t hurt to try those steps right now, prior to trying to add a new Sub-Server, to see if anything shows up.

If not, you might have to try it afterwards though…

So, thanks to your troubleshooting suggestions I think I see the cause.

Previously all of my port 80 virtualhosts were being created as: virtualhost *:80

The new virtualhosts are being created as: virtualhost

This apparently makes it the only available option for my IP address.

I see that in the Virtualmin Configuration -> Defaults for new domains there is an “Address format for Apache virtual hosts” option. Mine is set to “Decide automatically”, but it can also be set to “Always use IP” or “Always use *”.

Oddly enough, my :443 vhosts have the full IP defined.

My question now is: should I update all of my *:80 hosts to use the real IP, or set the option to “Always use *” for future vhosts? Is there a convenient way in virtualmin to do this update?

A secondary question would be “why did this suddenly change”, but I assume some very recent update tweaked the behavior slightly.

Just an update here:

I adjusted the new vhost to use *:80 instead of IP:80

I set the Virtualmin Config “Defaults for new domains” to “Always use *”

I changed all of my IP:443 vhosts to use *:443

Now that everything is consistent, it appears to work fine. Funny that some (unknown) update threw a wrench into the whole setup.

Hopefully I’m not making any terrible faux-pas by using the wildcard, but this way seems more future proof in case the IP changes at some future date.


Were any of the VirtualHosts on your system there setup with x.x.x.x:80? Or were they all “*:80” until the most recent one you added?

Normally, Virtualmin will continue to use the same format when adding new ones… however, if somehow there were a mix of formats, that could confuse Virtualmin.

Usually though we recommend using x.x.x.x:80, and that’s the default format Virtualmin will try to use.


They were all *:80 until today virtualmin started creating them using x.x.x.x:80

If I understand, apparently once you add a virtualhost with an IP, any requests using that IP will no longer match the wildcard-based virtualhosts, effectively disabling them.

There was a recent apache2 update as well as a recent virtualmin update. Maybe one of those changed the default behavior.

So, Virtualmin has long had some behavior that caused some confusion.

It never really knew what to do when there was a mix of entries… some x.x.x.x:80 and some *:80.

In the past, when that occurred, it would just guess that the new one should also be *:80.

But we found that caused a lot of problems and unexpected behavior.

Joe tells me that the recent Virtualmin version switched that behavior… if both types are found, rather than adding the new one as *:80, it should add it as x.x.x.x:80, which should should be a bit more of a predictable behavior.

Now, what we don’t want is for it to add new ones as x.x.x.x:80 if all the existing domains use *.80, as that’s not expected at all. If all the existing ones are *:80, it should, in theory, add new ones using that format.

So what we’re hoping is that maybe somehow, an x.x.x.x:80 one snuck in there somehow and caused the confusion. However, we’ll need to look into that to verify that.


I just did a text-search of all of the .conf files in my sites-available directory. All of the port 80 virtual hosts use/used *:80

However, for whatever reason, all of my SSL port 443 virtual hosts used x.x.x.x:443

I’m not sure if there is another setting somewhere that could have confused things.

In order to make them consistent, I switched them all to *:443, and set Virtualmin to use *:port in the future (although perhaps I should consider changing everything to use a defined IP rather than the wildcard?).

In any case, I appreciate your help and discussion!

Also, Joe just posted a further explanation of the recent change of that default here:

Thanks for the follow up! And, yep, the SSL hosts would have triggered the IP behavior in the new version (they’re all the same…they’re just VirtualHosts, it doesn’t matter what port they’re on or whether they have SSL enabled or not).

This is new behavior in 6.04, and I should have mentioned it in the changelog, since it will surprise folks relying on the old behavior. I didn’t expect it to affect many people, as we’ve always recommended sticking to one or the other exclusively, which Virtualmin will continue to handle correctly. It’s easy to change IP addresses for your domains, and there’s a form for it in Virtualmin which changes it everywhere (DNS records, VirtualHosts, etc.). So, if you’re just “future-proofing” you don’t need to use *. But, for cloud-based hosts where the IP changes with every reboot, you’d probably still wanna use *. (This is very uncommon, though. Even cloud-based hosts with dynamic IPs usually give you the same one as long as a single “instance” exists.)

The old behavior was sort of a longstanding misfeature in Virtualmin…one we somehow never got around to fixing, despite having years worth of “the wrong site shows up” questions. It sounds like you’ve found the necessary settings to get the behavior you want going forward, so you should be fine.

Great, thanks for the detailed explanation! The changes to Virtualmin’s behavior make perfect sense as you’ve explained them. I’m not sure how my setup got split between *:80 and IP:443 originally, but everything seems to be working fine now that they are consistent.