*.domain.com points to primary virtual server

11 posts / 0 new
Last post
#1 Sun, 01/17/2010 - 11:17
leanopen

*.domain.com points to primary virtual server

Hello Guys,

Let's say I point domain.com to my server with centOS 5.4 and virtualmin installed. Than I create a virtual server which has user1.domain.com a its domain name. whatever.domain.com goes to user1.domain.com as well.

Than I create a virtual server witch has user2.domain.com as its domain name. And I'd like that whatever.domain.com goes to user2.domain.com. But it still points to user1.domain.com.

How do I change that?

Greetz, Milan

Sun, 01/17/2010 - 11:27
andreychek

Hmm, it sounds like you may need to add whatever.domain.com as a Virtual Server alias to user2.domain.com.

To do that, choose user2.domain.com from the dropdown list on the top-left, go into Create Virtual Server, then choose to create an alias server.

At that point, just add whatever.domain.com -- would should then cause that domain to point to user2.domain.com when you browse to it.

-Eric

Sun, 01/17/2010 - 11:37 (Reply to #2)
leanopen

Thanks for you reply

But thats not really what I meant. I meant that I'd like that whaterveritypehere.domain.com points to user2.domain.com.

Sun, 01/17/2010 - 11:54 (Reply to #3)
andreychek

Hrm, are you saying you want a wildcard subdomain, so that *.domain.com all displays the same content?

You can do that by going into Server Configuration -> Website Options, and set "Website matches all sub-domains" to "Yes".

Also, there's the concept of a "default domain". The first VirtualHost configuration Apache runs into in it's config file is the default domain for that particular IP address.

If you wish to change what domain shows up by default, you can set that in the Website Options screen if you're using Virtualmin Pro... or just manually move the VirtualHost configuration in the Apache config file if you're using Virtualmin GPL.

-Eric

Mon, 01/18/2010 - 16:41
leanopen

Thanks that helped :)

Tue, 10/19/2010 - 11:58
raymor

You can do that by going into Server Configuration -> Website Options, and set "Website matches all sub-domains" to "Yes".

Is that option in Virtualmin Professional only? I don't see it in this GPL version:

Webmin version 1.520 Virtualmin version 3.73.gpl GPL

I edited line 97 in virtual-server/domainname-lib.pl to accept something starting with *. as a valid alias. This isn't that uncommon - ears ago many hosts did it by default because you want typos like wwww.site.com and ww.site.com and such to come to you, not be lost traffic.

Tue, 10/19/2010 - 12:27 (Reply to #6)
Locutus

...at least it does appear for me in VMin 3.80 and 3.81.

And I don't know if manually editing the VMin script files is such a good idea... considering they can be overwritten during updates and stuff. :)

Tue, 10/19/2010 - 12:36
andreychek

Hmm... actually, you're both correct!

That feature is not Pro-only, but that's only the case since Virtualmin 3.78 or so.

In version 3.73 (which is fairly old at this point), that actually was a Pro-only feature.

My recommendation would be to upgrade to the most recent Virtualmin, which will allow you to select a given Virtual Server as the default.

-Eric

Sat, 07/26/2014 - 01:12
ms308680

sorry to dredge up such an old post, but is there an option to enable the "Website matches all sub-domains?" option to on as default. I figured this would be in server templates but did not see it.

Thanks,

Tue, 07/29/2014 - 07:16
Locutus

You're right, I don't think such an option exists. It might be a good idea to add it indeed.

Until then, it could help to manually add the required Apache and BIND directives in the template. For Apache, adding the line ServerAlias *.${DOM} should help, and for BIND, you'll want to put *.${DOM}. IN A {IP} and set the radio button to "Add above to automatically generated records".

Wed, 09/17/2014 - 09:45
just_me

Well,

i am in the same boat, but want to achieve something slight different:

i want to have:

user1.example.com user2.example.com user3.example.com *.example.com

The option "Website matches all Subdomains" will get user1.example.com to www.example.com, as with all other subdomains, so no avail.

The option to set the standard website does not help either, because there are other domains like www.atest.com, which will be in fact the first one in the directory, which will be chosen as default domain. Can't i have a default domain per domain? so to say, whateveritypehere.example.com will be routed to www.example.com and also whateveritypehere.atest.com will be routed to www.atest.com? This is confusing the visitors. If i have two different own projects, one for IT the other one for Audio/Video, and the audio video guys have a typo in the according subdomain and they end up in the IT part.

Any chance to achieve this, and how? I heared, that others should have it, but i am not sure, whether this is correct...

Thanks for help!

Topic locked