Root hostname redirects to virtualserver.

Hi all,

I have a problem where navigating to the parent domain name on this server in a browser, redirects to one of the virtual servers set up on the box.

I’m new to webmin so have trialled a few setups while getting things configured, part of that process is that the parent host name used to be one the the virtual servers set up so maybe that’s causing the problem.

I’m running my own nameservers and all virtual hosts are set to use these local nameservers in the default server template. Nameservers are ns1.parentdomain.com, ns2.parentdomain.com.

I’ve looked at the apache config and the home folders are correct.

Can anyone please suggest where else I might look.

TIA

This is probably expected behavior. Apache serves the alphabetically first virtual host for all hostnames it does not know.

You can define a specific domain as the default in Virtualmin under “Server Configuration -> Website Options -> Default website for IP address?”.

Thank you for the reply Locutus, this advice has helped me understand. However this ‘Default website for IP Address’ setting appears that it can only be used for other virtual hosts on the box and cannot be set for the parent host, i.e. in Webmin.

Orinally when I set this up the parent host was the default and content was served from /var/www/html. I’m not sure at what point this changed or what I did to change it.

Following advice from other threads on this forum I have created a dummy virtual server and used this as the default by setting the Default website for IP address option. This seems like a rather messy sollution however and I wonder if it will cause me issues down the line.

Is there a better way to revert back to the parent host being the default and serve content from /var/www/html again?

It’s not recommended to use /var/www as a document root in Virtualmin, since its suexec version will run only from /home. You should better put all web contents you wish to serve into a virtual server under /home.

OK thanks for the info, I shall continue with my current configuration.

Hopefully there won’t be any gotchas lurking while running things this way. I’ll update here if I find any.

Thanks again.