Subdomain failing

OS type and version Ubuntu22.04
Webmin version 2.101
Virtualmin version 7.37 Pro
Related packages SUGGESTED

I have created a subdomain underneath my main domain. It went through all the steps without any issue.
However when I then attempt to navigate to the site, there are two issues

  1. The site is still being seen as http instead of https, despite it showing that it has a certificate issued by Lets Encrypt
  2. its not serving the content in the public_html folder

This is not the first time I have had these issues, however I have had to leave it until now. However now it has become a critical issue whereby we are ready to deploy our websites, but its impossible.

Please help urgently


What did you actually do? (There is nothing called a “subdomain” in Virtualmin, unless you enabled the old/deprecated cPanel-style subdomain type.)

Did you create a sub-server?

hi. yes sorry, a sub server - I come from a cpanel environment, so im used to the term

The redirect to SSL is a selectable option in Virtualmin > Website Options.

It can also be done in .htaccess if necessary for some oddball reason:

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

I can’t think of any reason why that should be necessary except maybe if the site was migrated from cPanel. They do some weird shit in .htaccess that should be carefully removed once the site is no longer on that panel.

As for public_html content not being served, what’s the exact absolute path? You may have the files in the wrong directory. That happened to me a few times right after I came over from the dark side.


OK so I have just set the option to redirect to ssl, and it STILL takes me to a default page which is not SSL.
The site is a simple wiki placed in the sub server’s folder , ie : /home/three2o/
I set the options to use SSL as above, and also tried with a .htaccess file. Nothing changes


I have just made a change in the html of the default page stored in the above site… and it doesnt go there at all. it still shows the main website default one. (I tested this by making a change in the html of the main website)

I have just also made sure that each of the websites (, and all have the redirect to SSL on, and now when I navigate to the sites, It tries to go to the HTTPS, but then cant find it, so reverts to http… even though there is a certificate and it should be using it.
I have no idea whats wrong.
This is about hundreth time I have tried to get this to work. I have even created new servers, thinking I did something wrong, and always have the same issue.

this one works fine

is using the wrong certificate

is also using the wrong certificate, both in fact are using the certificate for easiest answer is to request certs through the sub servers ( & ssl certificate management pages virtualmin :arrow_right: server name :arrow_right: server configuration :arrow_right: ssl certificate :arrow_right: lets encrypt and request a certificate for each, so a real world example is

virtualmin :arrow_right: :arrow_right: server configuration :arrow_right: ssl certificate :arrow_right: lets encrypt

This assumes you have create the sub servers using the virtualmin module, if you have created the sub domains a different way (created the virtual server outside of virtualmin) this will not work & you will have to manually request & install the certificates
The page should look like this

ok thanks! Will try that now. Yes, was all created through virtualmin.

Ok, done that, and its made no difference.
They are both still saying that its not secure, and both are still pointing to the main site (

You have something wrong in the subdomains config, check the access/error logs for each sub server for clues
located at

/home/username/domains/sub server name/logs

The error logs and access logs are empty for and dont even exist in
I would expect that simply creating a sub server from virtualmin would set it up without any issues. I created them using the default settings , so it should just work out of the box, no?

This seems like a variation of “the wrong site shows up” from our troubleshooting guide, though I’m not sure how it would have happened.

It sounds like the first site configured in Apache is, and for whatever reason the other domains aren’t matching any configured VirtualHost, so it falls back to the first one. Apache has bizarre and incomprehensible heuristics for deciding what to serve in the event of no exact match.

If I had to guess, I would say you have IPv6 enabled in Apache, but it is misconfigured or these VirtualHosts do not have IPv6 config. (but, it could be SSL misconfigured, or other IP-related or port-related tomfoolery).

Hi. Ok, so I have had a look, and this is what is showing for the sub servers:
*** System restart required ***

Last login: Mon Aug 14 06:15:57 2023 from

ubuntu@devserver:~$ ip addr sh

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet scope host lo

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc mq state UP group default qlen 1000

link/ether 02:87:6f:b5:3c:06 brd ff:ff:ff:ff:ff:ff

inet metric 100 brd scope global dynamic eth0

valid_lft 2420sec preferred_lft 2420sec

inet6 fe80::87:6fff:feb5:3c06/64 scope link

valid_lft forever preferred_lft forever

ubuntu@devserver:~$ grep -i ‘virtualhost’ /etc/apache2/sites-enabled/*.conf





/etc/apache2/sites-enabled/<VirtualHost *:80>


/etc/apache2/sites-enabled/<VirtualHost *:443>


/etc/apache2/sites-enabled/<VirtualHost *:80>


/etc/apache2/sites-enabled/<VirtualHost *:443>



So it seems that the subservers are using *.80 and *.443.
However what IP address should they have? its all on the same server, so surely it. should be the same IP?

and how do I set it so that when creating a new sub server it gets the correct IP?

Yep, that’s the problem. It must be either all using the IP or all using *. Otherwise, the IP will “win” the matching. Apache behavior is insane on this.

I’m not sure how you got this mixed config, though. Virtualmin has a configuration for this, in Virtualmin Configuration->Defaults for new domains->Address format for Apache virtual hosts

You’ll need to fix it manually in the existing sites, I think, once you decide which one you’ll be using (use * if the IP changes regularly, or the IP if you’ll ever have other IPs or if the IP remains the same over time).

ok thanks. Yes the IP is static and will never change.
I will check the config in virtualmin and see whats in there

mmm. Seems to be an issue in Bind
× named.service - BIND Domain Name Server

Loaded: loaded (/lib/systemd/system/named.service; enabled; vendor preset: enabled)

Active: failed (Result: exit-code) since Tue 2023-08-15 08:56:25 AEST; 1min 50s ago

Docs: man:named(8)

Process: 15993 ExecStart=/usr/sbin/named $OPTIONS (code=exited, status=1/FAILURE)

CPU: 17ms

Aug 15 08:56:25 devserver systemd[1]: named.service: Scheduled restart job, restart counter is at 5.

Aug 15 08:56:25 devserver systemd[1]: Stopped BIND Domain Name Server.

Aug 15 08:56:25 devserver systemd[1]: named.service: Start request repeated too quickly.

Aug 15 08:56:25 devserver systemd[1]: named.service: Failed with result ‘exit-code’.

Aug 15 08:56:25 devserver systemd[1]: Failed to start BIND Domain Name Server.

I have no idea why it wont start up?

That’s a new problem, wholly unrelated to getting the wrong site when you browse to one of those domains. Start a new topic about BIND.

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