Change default domain?

SYSTEM INFORMATION
OS type and version AlmaLinux 9.2
Webmin version 2.021
Virtualmin version 7.7 Pro

Real simple question.

How do I change virtualmin.domain.com (port 10000) to be at (www.)domain.com (port 10000)?

I tried using the “Change domain name” feature both via browser and even command line, but it still listens to the original URL (but can’t “connect” to services) and ignores the new URL.

Don’t!

The default domain is not meant to be used for anything. It’s supposed to be a temporary method of contacting your server with a working Let’s Encrypt certificate until you get some real domains setup. Just create your new domains! Ignore the default domain. It is “free” in the sense that it does not count against your Pro license domain count, and it is limited in the sense that it has most features disabled. (But, I continue to think it’s a bad idea, because it’s confusing for users…and this is another way it is confusing.)

I was wanting to move it to the root (main) domain instead of a subdomain so that it would host my main site (80/443) with the Virtualmin being via a different port.

OK, let me make sure we’re talking about the same thing:

The domain you’re wanting to change is the automatically created domain that is named after your system hostname? Is that right?

If so, you should not change it, you shouldn’t use it for anything. The automatic domain is not meant to do anything, other than provide a Let’s Encrypt protected connection while you’re creating new domains.

You should create a new domain to be your “main” domain, and you can tell Virtualmin to treat it as the default domain (the one served first if nothing else matches).

And, if you’re, instead, talking about the domain that Apache treats as the “default” (the one served if nothing else matches exactly), you can change that. It does not need to be the hostname of the system, and almost certainly should not be the hostname of the system. The hostname of the system should not match any domain you’re hosting mail for.

Virtualmin is always via a different port. It runs on port 10000. It’s a different web server from Apache. (Though there is a magic redirect for admin.domain.tld, as well, if DNS is setup for it, but it just redirects users to port 10000 on the domain name. It’s a convenience for folks who have a hard time with ports.)

The hostname is what I chose it to be. It actually defaults to “vps#####” where the # is the number of the service number running the VPS. But I changed it so that when installing Virtualmin, it will install just fine instead of prompting me for a proper domain name.

I’d like to adjust it so that…
domain.com (80/443) = website
domain.com (10000) = Virtualmin
domain.com (xxxx) = phpMyAdmin

I know how to do the last one, that’s not an issue. Just would like it to all be under one domain name instead of virtualmin.domain.com.

Don’t adjust it! Forget that domain exists. Create new ones. Create a new domain domain.tld.

The automatically created domain isn’t a real Virtualmin domain, and it is not the “main” domain. It’s just a temporary thing, intended to make browser cert warnings go away when possible (i.e. when DNS works for the system hostname). It is not intended to be a thing you do stuff with or that you continue to use to communicate with the system, after you’ve created new domains.

This is a new feature that came in the most recent release or maybe one before that, and it has turned out to be very confusing, so it is getting an overhaul soon. Just ignore it. Create your new domain on domain.tld, and put all your stuff there. Then set it to be the “default” domain, which will make it the one Apache serves if nothing else matches perfectly. Then forget that the system hostname even has a domain on it, because nobody should ever need to see or connect to it ever again, because now you have a real domain with all the features you want in it.

What is so wrong or bad about having it as the main domain though? Is it a security concern or just looking at it from a simplicity perspective?

It’s just not how it was intended to be done or what it’s for (though I agree its intended use is confusing and a poor design choice)…and you’ll run into problems with mail (mail in Virtualmin is always virtual, and listed in the virtual map, but mail directed to the system hostname itself, would be listed in both the virtual map and as a destination on the system itself).

That said, if you change it without changing the system hostname, then you’re fine on the mail front, though I’m not sure if it’s possible to turn all the features on again for this automatic domain (I don’t know the specific implementation details).

But, also, I feel like you’re making this domain special, when it’s not. There is nothing special about the system hostname, and there is nothing special about any given domain in Virtualmin. The first domain created in Virtualmin (including this automatic domain) will be listed first in the Apache config, and thus it will be the “default” domain served if you hit the IP or a name without a VirtualHost, but that is configurable and changeable at any time.

It’s not that I think it’s a special domain, only that it would be making use of one domain name for the main website as well as accessing Webmin as needed.

You can use any domain name managed by Virtualmin to access Webmin (and Usermin). If it has a Let’s Encrypt certificate Webmin will use it. You don’t need to use the system hostname (or the automatic default domain) for accessing Webmin once you have other domains.

So domain.com:10000 should work? If so, then where do I look to troubleshoot it not loading?

Yes, every https://domain.tld:10000 (for every domain managed by Virtualmin) should work, and it should work without a certificate error if domain.tld has a valid certificate managed by Virtualmin.

There’s almost nothing to troubleshoot here. If Webmin is running, and if domain.tld resolves to the IP address is the server where it is running, it will answer.

What error do you get?

No error, just no Webmin responding.

That probably means that name doesn’t resolve to the right IP. Webmin listens on all IPs on the server, by default, and will answer any request on port 10000, regardless of the name in the URL. The name in the URL only decides which certificate gets served, assuming that name resolves to the IP on which Webmin is listening.

Only one IP address and the name definitely resolves to it as the webpage for the site loads just fine.

do you get a positive result if you use the dig utility on the command line ?

dig domain.com

you should get a result like this


does the IP address match the one setup in webmin/virtualmin ?

Okay, issue was from the site being proxied via Cloudflare. Is there any way to make it work despite that?