Different subservers always load the same page

I need to keep multiple versions of a website online during its development until it is completed.

So, in a server with Virtualmin I created a virtual server with several sub servers; then in a VPS with Webmin I created a zone for the domain with multiple subdomains using A Records that all point to the IP address of the main server assuming that Apache directs each request to the right subserver.

At the moment I have only restored the first version and the others contain only a script necessary for the others restore, but when I recall the URL of these other domains the first one always appears.

The Home Directory is always different and refers to
/home/main-domain/domains/sub1(2, 3, 4, …)/public_html.
Even in Apache the Virtual Servers seem correct; on the other hand, the only change I made after creation was the elimination of disk quotas.

I have read the documentation and several posts on the Forum.
I don’t understand what’s wrong.

SYSTEM INFORMATION
OS type and version Debian 12
Webmin version 2.105
Virtualmin version 7.10.0
Related packages SUGGESTED

Check your every subdomain here: https://dnschecker.org/ (A record).
Next:

Check these. If these user-friendly settings look good, you can investigate more in a technical way:

Webmin » Servers » Webserver » Edit Configuration Files (this manages how Apache handles your domains).

If you change anything, don’t forget to click the button down below “Apply Configuration”.

On Virtualmin » Edit Virtual Server – here you can recreate your Apache’s config file to default by disabling and enabling the Apache website option (in the worst case scenario).

If all these are good, then it is probably your script redirecting you. Webmin » System » Bootup and Shutdown – can be also helpful.

1 Like

Both the domain and subdomains propagated successfully across the world.
In the Apache configuration files, both the domain and the subdomains, I don’t see any errors. For example the directories are correct and I don’t know what else to look for.
Disabled and re-enabled the subdomain virtual server.
I have already restarted the server several times.

I found a very “smart” way to spend the Easter holidays. :worried:

This is some variant of “the wrong site shows up”.

https://www.virtualmin.com/documentation/web/troubleshooting/#The_Wrong_Site_Shows_Up

Could be IPv6 misconfiguration, could be a mix of * and IP-based VirtualHosts, could be a web application installed from the apt repos that sets up a “default” website that’s incompatible with virtual hosting, etc. Many possibilities, but all the same type of misconfiguration in Apache.

Search the forum for “the wrong site shows up”, you’ll find dozens, maybe even hundreds, of examples.

Thanks for the reply.
Today I will read everything calmly.
It shouldn’t be IPV6 because when I created the virtual servers I always set IP V6 to “none”, but I don’t know where it is defined. IPV4 is the same on all subservers.
Instead, I wonder if the problem lies in the DNS because I see that in Virtualmin all the zones are defined as “Master”.
I already have a VPS called “ns1” with Master zones in Webmin and a second VPS “ns2” always with Webmin and “Slave” zones.
Does having “srv1” as Master also cause problems?

I would already be of the idea of resetting the server and installing it all from scratch; right now I wouldn’t lose much of what I’ve already done.
In which case, how should DNS be configured at installation time?

What in the world would make you think that’s a reasonable idea for fixing a simple problem?

I didn’t say it’s the best solution, but, being newbie with Virtalmin, I was wrong to install everything at once and without a protective backup.
Even reading the latest posts after your report, I can’t find anything wrong and now I have to check too many things.
Maybe I should reset everything and install one piece at a time while also doing a step-by-step backup.

Meanwhile, I confirm that the DNS is not aligned.
ns1 and ns2, yes (with Webmin), but srv1 (with Virtualmin) has completely different zones even if the IP address is always the same.
The domain panel at the company where I registered it points to ns1 and ns2.
Maybe the Master needs to be on srv1, but I knew it was recommended to keep DNS Master and web server separate.

1 Like

Only you know what your DNS servers are. Virtualmin guessed it would be managing DNS for you, but if you haven’t delegated to Virtualmin, then it makes no sense for Virtualmin to be managing a local DNS server with all your zones. So, if your DNS is hosted elsewhere, you’d disable DNS in Features and Plugins.

I don’t think I see how that would relate to the problem you have with you websites, though. The same site on your server always showing up (assuming it’s a site on your sever, if it’s a site on another server, then obviously DNS is wrong) means DNS is working. It’s web server configuration that’s wrong if the wrong site on the same server shows up.

OK, so I keep NS1, NS2 as Nameserver and SRV1 for web servers (disabling DNS in Features and Plugins).
When I installed the Virtual Servers I had visyo create the various MX records, etc. in the DNS. Now I will have to create them in NS1, but where will I find the configuration parameters?

I deleted everything and installed the server from scratch, so I’m taking it one step at a time.

If you disable the DNS feature, Virtualmin will have a “Suggested DNS Records” page.

I’m back to the original problem.
New server, DNS in Virtualmin disabled, only one VirtualServer and then only one its Subserver.
Nothing installed in the home directory, there is only the default index.html.
Two different browser (working in Chrome, testing in Firefox); canceled everything from the beginning; anonymous mode.
If I type http://server-name.tld in the browser, the URL is correct, but the default subserver page appears (the name of the subserver appears in the title).

The two .conf files in apache2/sites-availables are apparently correct

I wonder, should the subserver be created with just the subserver-name (like I did) or with subserver-name.server-name.

Appearances are deceiving. The problem remains your Apache configuration.

I’m guessing you’ve got IPv6 misconfigured or some default site something or other.

I have no idea what you’re talking about.

In theory IPV6 should be disabled: it is commented in hosts and in Virtualmin it is not present in the configuration of the two virtual servers.
What other places should I check?

When creating a Subserver what should be indicated in the domain name:
Just the “name-subserver” or “name-subserver.server” ?

You mean you used just a bare word? Not a domain name? That can’t possibly work.

i.e. if I had a parent of virtualmin.com and I wanted joe.virtualmin.com, just typing joe in would create a VirtualHost for joe, which would only ever be resolvable locally. That’s not a name that can be used on the internet.

A sub-server can have any name. It is not a “subdomain” of the parent. I could also create joe.example.com as a sub-server of virtualmin.com.

Sub-servers are about ownership, they have nothing to do with names. You can have a parent domain called joe.virtualmin.com and one called virtualmin.com, and they’ll be managed by two different users.

But, you always need a name that can resolve on the internet for it to work on the internet. joe is not a name that can resolve on the internet.

1 Like

This will certainly be the case, but the configuration is the default one.
I don’t seem to have changed anything after installing Virtualmin.

I was writing the same thing. I went to check my apache server and in sites_availables all the names were FQDN.
Tomorrow I’ll do some new tests, but now a first summary test seems to be positive.

I confirm that everything is fine.
There are other problems, but the ones reported in this post have all been resolved. I will point out the others separately.
I apologize to all of you for my mistake, the result of haste and distraction.
Thank you for your help and, above all, for your patience.

1 Like

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