Sub Servers redirecting to their top level Server

SYSTEM INFORMATION
OS type and version Debian 10
Webmin version 2.021
Virtualmin version 7.5PRO
Related packages SUGGESTED

Hi Gents,

Ok we have a top level domain server

top-level-domain.com

now to that I’m trying to add two subdomain servers with their own home directory and websites.

So everytime I create the two subdomains

subdomain1.top-level-domain.com

and

subdomain2.top-level-domain.com

and we try to browse to them the server seems to redirect us to

top-level-domain.com

and I can’t work out why, its starting to do my head in.

I have checked all the usual redirection settings and went as far as to look at the site conf files located under /etc/apache2/conf-available/*.conf

I have compared it to all other conf files in there including ones doing the same thing and they all look ok.

So now I’m at a loss, any help would be greatly appreciated.

did you tick Create home directory to store the website?

Sure did, but to no avail

works fine for me. when you create it, is this what you see this in filemanager.
P.S. Did you make a A or CNAME record for it?

Probably your SSL is messed up. If you have an SSL policy and for some reason your new sub domains didn’t copy that SSL over, then they will default to the default domain, which is almost always your top level domain.

Hi Gomez,

So what you are saying is recreate the subdomains but omit the SSL component and then perhaps add it later?

Yeah all this is fine, I get the home dir and the structure of it is indeed correct.

Just when I browse to it I end up being redirected to the top level domain and that’s unfortunately the issue I’m wrestling with.

funny thing is that this is the only domain it does it on.

If I could delete it an start again I would but the problem is that the client has mailboxes and a website so that would be a nightmare to move around.

In apache on webmin does everything look ok?
While there give it a restart, can’t hurt.

The whole server or just Apache?

I restarted Apache but no joy

Just apache, you should see its directives

See it looks fine

Look there has to be something elsewhere, I have looked in the DNS I have looked in the website redirects etc and everything looks perfectly normal.

ok, so you only have port 80, no 443?
does it work ok using http://?

No, I didn’t say that at all.

What SSL certificate are you using? Is it a self-signed? Are you sure it’s installed properly?

Any time you wind up at the default server on your Vitualmin is usually because of either a DNS issue or an SSL issue. One or the other isn’t working properly.

In my experience it’s almost always an SSL issue - either a certificate isn’t installed properly or is a self-signed certificate.

Are you sure you’re using a proper SSL certificate from LetsEncrypt or another reputable provider?

what website do you have in subserver? maybe website is doing the redirect (in db or configuration)… (?)
without proper logs/urls/apache confs, can’t help more…

Ok so the SSL certificate was one of the automated ones from Lets Encrypt that the system uses.

But for the purposes of this exercise I have removed the SSL component and its still redirecting.

So essentially only port 80 so http right now

initially a blank install of WordPress, but I have even removed that so its just a blank sub-server.

every virtual server should have a port 80 and port 433 in the apache config, does yours?

This is usually the some variant of “the wrong site shows up” from the troubleshooting guide.

You probably have one of several issues that makes Apache believe some other site is a better, more specific, match for the URL. It could be that some sites have explicit IP and some have * (the explicit would take precedence) or SSL is not enabled on both and you’re connecting to SSL. Or, it could be that you have IPv6 enabled, but not configured correctly (this one is quite common lately as more hosts start enabled IPv6, by default). There’s a whole lot of reasons Apache will think you want a different site than what you think you’re asking for.

1 Like