How to disable or not create admin, mail, webmail and www subdomains when creating new domain

SYSTEM INFORMATION
OS type and version Ubuntu Linux 22.04.4
Webmin version Webmin version 2.111

My Virtualmin uses NGINX.
Hello

I would like to disable the creation of these subdomains every time i create a new child server in my Virtualmin.

The domains i do not want to be created each time are:

mail.mydomain.com
webmail.mydomain.com
admin.mydomain.com
www.mydomain.com

I have tried this so far:

  1. Server Templates > Settings For Sub-Servers > Website for subdomain > These options have these values:

[Redirect webmail.${DOM}] no
[Redirect admin.${DOM}] no

  1. Server Templates > Settings For Sub-Servers > DNS Domain > These options have these values:
    [Address records for new domains] Domain name www ftp localhost m

I have searched a lot and found theses posts but still can’t make it work:

disable admin and webmail subdomains when creating virtual servers

Any help on this topic is really appreciated.

I think the bit you’re missing is that sub-servers have their own Server Templates.

You should do exactly what Ilia explained, just do it in the Template you are using for Sub-Servers.

Hi Joe, thanks for replying.

At that point is where i’m stuck. I don’k know exactly where to disable the subdomains.

I have the template set up like this:

  1. Server Templates > Settings For Sub-Servers > Website for subdomain > These options have these values:

[Redirect webmail.${DOM}] no
[Redirect admin.${DOM}] no

Then i saved and created a new child server, then the new subdomains, all of them, are created again.

When creating a new subserver i make sure i select the template (the only one available) like this:

Could you please guide me a little bit more in detail, how i can do it?

I don’t know what to make of that. That should do it.

Maybe a bug? I think it’d have to be a new one, since no one has ever mentioned it that I can recall. @Ilia are you able to reproduce this?

By this, do you mean that you don’t want those sub-domains added to the Nginx config, or to DNS records, or both?

When you create any virtual server or a sub server you get the following redirects created automatically:

I think the OP wants to create sub-server without these additional sub-domains so forcing the clients to use the parent domain for webmail, admin login and for the mail server. Also he does not want the www for each of the sub domains

1 Like

So the admin and webmail sub-domains can be turned off in the server template already, at least in theory. However, it looks like the real issue is that for sub-domains that setting isn’t being respected, at least when using Nginx.

@Joe, yes, I can, and it does seem like a bug!


It works both in theory and in practice! We recently fixed it, I remember it. @dubansoft Please make sure that you have the latest Virtualmin Nginx 2.36 plugin version installed!

It also worked fine for me when a template for Sub-servers wasn’t saved (inherited from Default settings). After it was saved manually, all options were correctly applied when a new virtual server was created, even if the options in the default and sub-server templates were different.

However, I encountered another, not directly related issue – Permissions on website subdirectory field was empty and just saving the form resulted in the following error:

Failed to save server template : Missing or invalid permissions for website subdirectory

But setting it manually to 0750 worked as expected. :beetle:


@Joe, yes, I can, and it does seem like a bug!

@Jamie, after running deeper tests there are actual bugs: :beetle:

  1. When in Template → DNS domain page, under Address records for new domains option the admin un-ticks www. the records in DNS are correctly not created, however, those are still added in the webserver config, for both Apache and Nginx;
  2. The mail. record seems to always be created, even if mail for the domain is disabled. That doesn’t seem right, as there should be a way not to create it at all.
  3. m.${DOM} option still present in the UI, under Address records for new domains option, even though not created anywhere.

Hello Jamie, thanks for replying to my question.

By this i mean i dont want them to be created or registered at all. I only need the base domain.

Thank you!

Actually, my users will never know about the existance of an admin, webmail, or mail services as i deploy a custom app to my users. Also, i need those subdomains not to be created because i use a wildcard on my dns setting, so *.mydomain.com will get a Let’s encrypt certificate automatically.

When virtualmin creates those *.myclient.mydomain.com subdomains (admin, webmail, www.mail) the lets’s encrypt request will fail, then i have to manually install the let’s encrypt certificate, by manually entering the only domain I want, at the time of telling let’s encrypt what domains to issu a certificate for.

Hello Ilia, thanks for replying to my question

I currently have Nginx Webserver, version 1.18.0. I installed using the --bundle LEMP option.

This is a fresh OS install. Please guide me on how I can upgrade to nginx to 2.36 :pray:

I have googled that but there seems not to be any related results:

https://www.google.com/search?q=how+to+upgrade+lemp+on+virtualmin

Edit:
My OS is fully up to date:

Package updates All installed packages are up to date

I was referring to the Virtualmin Nginx plugin version. You can view its version on the System Settings ⇾ Features and Plugins page.

In this case, you must have the latest Virtualmin Nginx plugin installed.

How does the LE request fail exactly? I’d be interested to see the error message …