subserver redirecting to main domain

8 posts / 0 new
Last post
#1 Wed, 07/20/2016 - 10:15
elcubismo

subserver redirecting to main domain

Hey all,

So we have a website with 2 main domains (let's say domain1.com and domain2.com). Both use the same IP (say 123.123.123.123)

We have multiple sub-servers on each domain. We previously had all sites/domains hosted elsewhere and started this new system on another host. We were able to recreate the sites and have finally migrated everything over. All domains and "subdomains" that we set up beforehand are working correctly.

However, when we try to create a new subserver (let's say newsub.domain1.com) using the process we used before, it seems to work correctly but when we navigate to newsub.domain1.com, it simply redirects to domain1.com.

One difference I am seeing between the existing subservers and this new one is seen when viewing Virtualmin -> Website Options for that subserver: Default website for IP address? Yes

There is no way to change this: on the other sites, this is a radio button.

We are using the exact same process as before, and I am honestly confused.

Thank you for your time.

Wed, 07/20/2016 - 14:06
Diabolico
Diabolico's picture

Did you check if new subdomain is created as subserver and not alias?

One difference I am seeing between the existing subservers and this new one is seen when viewing Virtualmin -> Website Options for that subserver: Default website for IP address? Yes

This means if someone used your IP to connect instead of domain it will show the virtual server (domain) with "Default website for IP address?" set to "Yes". To change to another virtual server/domain, navigate to another virtual server and this option will be available to modify.

- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.

Thu, 07/21/2016 - 08:24
elcubismo

Yes, I had played with Aliases before and I am positive that we are choosing subserver. I have tried to create a new subserver multiple times and the issue remains.

So the default website for IP address is probably not the problem, but I just found it weird that all the others are set to No AND they can be changed, but this one is set to Yes and can't be changed.

Thu, 07/21/2016 - 12:58
Diabolico
Diabolico's picture

So the default website for IP address is probably not the problem, but I just found it weird that all the others are set to No AND they can be changed, but this one is set to Yes and can't be changed.

This is working as intended otherwise you would need another option to select what virtual server should be default. So to make it simple just open the VS what you want to be default and change this option. The old VS will automatically switch this option.

For subserver redirecting to main domain check htaccess file (if you have it) or apache conf file and search for any active redirect.

- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.

Fri, 07/22/2016 - 09:58
elcubismo

Hello Diabolico,

Thanks for your help so far.

Ok the only server that should be the default website for the IP address is the main domain name. Not sure why new subservers are being set this way.

We have no htaccess files on this or any of the other servers or subservers.

Another thing I'm seeing is that any new servers are automatically getting nameserver records added under Virtualmin -> Server Configuration -> DNS Records They look like this: ns1.hostingnameserver.com

*.newsub.domain1.com. IN A 123.123.123.123

ns1.hostingnameserver.com

newsub.domain1.com. IN A 123.123.123.123

ns1.hostingnameserver.com

The old subservers did not do this. They made the normal record changes such as this: oldsub.domain1.com. IN A 123.123.123.123

www.oldsub.domain1.com. IN A 123.123.123.123

ftp.oldsub.domain1.com. IN A 123.123.123.123

m.oldsub.domain1.com. IN A 123.123.123.123

localhost.oldsub.domain1.com. IN A 123.123.123.123

webmail.oldsub.domain1.com. IN A 123.123.123.123

admin.oldsub.domain1.com. IN A 123.123.123.123

But no nameserver records were added.

Fri, 07/22/2016 - 14:29
Diabolico
Diabolico's picture

Ok the only server that should be the default website for the IP address is the main domain name. Not sure why new subservers are being set this way.

It could be some setting in server template but frankly with all my testing i never saw this kind of problem. It could be some problem with the domain you want to set as default and then with each new server Virtualmin is trying to properly set default domain.

For name servers you should have A record for each one of them:

ns1.domain.tld. IN A xxx.xxx.xxx.xxx
ns2.domain.tld. IN A yyy.yyy.yyy.yyy

Of course if you have more name servers then the list go on with ns3..., ns4..., and so on.

- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.

Sun, 04/08/2018 - 03:39
xtz

I have kinda same issues regarding virtualmin dns querries. Example: I created virtual servers example1.com example2.com example3.com I set dns custom for all servers ns1.example1.com ns1.example2.com and ns1.example3.com Issues comes when i type on a browser ns1.example1.com it redirects me to latest virtual server website i created , in this example it sends traffic to example3.com No matter how many servers i create, when i try on browsers to check nameservers addresses it send trafic to latest virtual server created. In bind localhost create A Record to 127.0.0.1, it should be something else at localhost records?

Tue, 03/19/2019 - 19:26
tritium

Just in case, I ran into a similar problem and solved it by updating directly the apache conf file in /etc/apache2/sites-enabled/<your-site.com>.conf and replace in the first line the ip for an asterisk, for example:


replace for:

Topic locked