How-to create REAL sub-domains in Virtualmin ?

28 posts / 0 new
Last post
#1 Tue, 04/26/2011 - 01:47
bleck

How-to create REAL sub-domains in Virtualmin ?

Trying to find help about sub-domains creation in Virtualmin I only find explanations of how to create sub-servers. I also find tons of posts and articles saying "sub-domain is a cPanel concept that doesn't exist in Virtualmin" or "sub-domains are replaced by sub-servers in Virtualmin", blabla.

It would be perfectly clear if these repeated assertions weren't FALSE. Sub-servers and sub-domains BOTH exist in Virtualmin. I have met them !

Using the "import virtual server" form to import a cPanel backup archive I ended up with sub-servers and sub-domains. They all appear in the virtual servers drop-down list. If i select a sub-server and then "edit virtual server" it displays a page titled "Edit Virtual Sub-Server". If I select a sub-domain and then "edit virtual server" it displays a page titled "Edit Virtual Sub-Domain". That makes a first difference. Investigating further, I notice that sub-domains only have a limited set of features (DNS, SSL, Apache) the adminstrator can enable or disable.

Can someome explain (or point to an explanation) how-to create sub-domains ? Moreover which are all the differences between sub-domains and sub-servers ?

Thanks in advance.

(Virtualmin 3.84 GPL)

Tue, 04/26/2011 - 04:56
Locutus

Subdomains do exist in Virtualmin, yeah, but you do not need them. :)

The question indeed is: what IS a "sub-domain"? Especially, what is a "REAL sub-domain"? It is just a domain name that happens to have a common postfix with another domain. For Virtualmin, it does not matter if two parent servers have "example.com" and "child.example.com", or "example1.com" and "example2.com" as domain name.

The Virtualmin help says this about "sub-domains":

"Allow creation of sub-domains?" When this option is set to No (as it is by default), Virtualmin will not allow the creation of sub-domains, which are a special type of sub-server that is under the same domain as its parent. Only when Yes is selected will sub-domains be allowed - but this is discouraged, as they are confusing to users and provide little benefit over sub-servers.

Virtualmin uses the concept of "sub-servers", which is a server that shares the home directory and administrative account (hence, the "owner") with its parent. Nothing less, nothing more. Domain name structure is basically completely independent from that. Although you can set an admin restriction to have them be able to create only domains that are under the parent domain in their child servers. But that is an administrative restriction, not a technical one.

Wed, 04/27/2011 - 12:44
bleck

Locutus, thank you very much for your answer which contains the information I was looking for. It's been very helpfull.

About the discussion, everyone has her/his ergonomic preferences. The documentation you quoted says "...sub-domains are allowed but this is discouraged as they are confusing to users...". I don't think they are. Writing two contradictory assertions in two sections of the documentaion : that is confusing. Writing (or even worse, suggesting like "Virtualmin for cPanel Users" does) that sub-domains don't exist while the user can make the practical experience that it's not true : that is confusing too.

Every control panel has it's own concepts and uses it's own terms to name them. They just need to be explained. For instance, the term "server" in Virtualmin could be confusing since it's the only way to create what could be reasonably called an "administrative account", as you said. But it's not confusing to me since I accept the fact that the concepts and terms used in Virtualmin are specific to this software. I accepted it quite soon when I evaluated different control panels, a few weeks ago. The fastest way to understand a new CP's logic is to have no expectation about what an 'account', a 'server', a 'subserver', a 'resseller', etc., could be in this new software.

Last, do I need "real" sub-domains (the term real refering to Virtualmin's reality) ? The answer is Yes ;) Probably for the same reason it's been implemented. So you could also ask "Why do these nice people develop, maintain, "document" a functionnality they suggest not to use ?" Isn't that confusing ? ;)

Bleck

Fri, 04/29/2011 - 18:48 (Reply to #3)
Joe
Joe's picture

Locutus and ronald have provided excellent explanations of how things went down, but I'll confirm it from an official position:

About seven years ago, we made a terrible mistake. It is a mistake that we regret to this day. Subdomains, as implemented in cPanel, are stupid. We implemented a version of them on a whim, because a lot of users, at that time, were migrating from cPanel, and they wanted familiar territory. We regretted it from the very first version in which they appeared; and threads like this remind us of the regret and pain and suffering we caused with that mistake. The support load caused, and the amount of confusion caused, by "subdomains" was probably the largest of just about any feature we've ever implemented. People coming from cPanel understood them (mostly), nobody else did. People assumed that if they wanted a subdomain named website, it had to be a "Subdomain", which doesn't even make sense.

If you got subdomains when migrating a cPanel backup, that would be a bug, and we'd want to fix it. They're supposed to be converted to subservers unless subdomains are enabled. Some day in the future the subdomain feature will be made invisible (only enable-able via direct editing of config files), and some time after that the feature will be removed. We really hate that feature.

But, I beg of you: Do not use "Subdomains". Do not enable them. Do not speak of them. Treat them like Voldemort. They are the thing that must not be named for fear of driving Joe mad.

When you want a subdomain named domain, just name a virtual server or sub-server with the subdomain name. Names mean nothing to Virtualmin. As far as Virtualmin is concerned you can name a virtual server sub.virtualmin.com and have one of its sub-servers be named virtualmin.com (or both could be separate virtual servers, or both could be sub-servers of webmin.com, for instance). There is no relationship between the name and the ownership of the domain in Virtualmin. Subdomains are just domain names, like any other.

I'm with you on the potential for confusion of "Virtual server" equaling "management account". That was a tradeoff we made many years ago and it stuck. I'm honestly still not sure we made the right decision, but we're nearly a decade in now, and we can't change it. The goal was to shorten the path from "I want a website" to "I have a website". In Virtualmin that's one form. "Create Virtual Server" is all you need to know to go from "want" to "have", so that's good. The negative is that people coming from panels that have an intermediate "I want a user that can create websites" step can become confused.

--

Check out the forum guidelines!

Wed, 04/27/2011 - 13:33
ronald
ronald's picture

Afaik the subdomain was implemented years ago and then there was this realisation that it wasn't a best practise to have it done this way.
So sub-server came up, but helas the previous method was so woven into the system that it was not an easy job to take it out.
It stayed there but switched of by default.

If I am mistaken about the happenings I would gladly be corrected by the virtualmin team.

Fri, 04/29/2011 - 19:30
Locutus

"The feature which must not be named"... now THAT's funny. :-D

I now feel tempted to take this "defense against the dark arts" class and try out what "subd... uhm, you-know-what" actually do. ;)

As for confusing terminology. Maybe Virtualmin could use a "glossary" section, in the online help, in a prominent place, maybe as part of the first-start wizard too, to clear things up right from the start. :)

I personally had the advantage that VM is my first control panel that I'm using this extensively, so I was not "spoiled" with different concepts and terms. It didn't matter to me whether a "virtual server" is called that or something else -- the fact that you can turn features on and off for it like "web site, DNS zone, mail, database" etc. made it clear that "server" actually means "account" in general.

All I might complain about there is that it appears a little unintuitive and unnecessary that you need to give the virtual server a domain name, even if you intend to only use it as an "administrative parent" for several subservers. Of course that name can be some dummy text, still it feels a little odd for someone who loves clearly structured and defined stuff (working at University in Computer Science does that to you ;) ).

Fri, 04/29/2011 - 19:32
Locutus

(Double post due to server error deleted.)

Sat, 04/30/2011 - 04:08
bleck

Thanks Joe for you long explanation and for sharing your knowledge of the history of this VM project.

I confirm that "subdomains" were disabled when I imported my cPanel backup and that the import process created subdomains/

I understand the ' "want" to "have" ' argument though I think the present (and historical) solution is not a very good trade-off between ease of use for hosting-newbies and clarity of concepts. Filling a single form could lead to the creation of an [server] account and the generation of a first [sub] server. The hosting-newbie would have an immediate ready to use virtual web server. Of course the root directory of this server would in the domains directory and not in user/public_html. And that's where is should be, since using user/public_html as the defautl root directory is another bad cPanel practice.

Another bad practice is not to consider www.domain as an ordinary domain. Once again there is a confusion between building concepts and ergonomy/interface. As a result of this confusion, in VM, the only way (I found) to create a specific www sub-"something" is through sub-domains. It's not a theorical problem...

Many of my clients just need to host their web application at www.theirdomain.tld. Their dns, mail and some extra services (such as web redirection) are provided in an extremely reliable way by their registrar. All services are included in the basic domain name registration package. In such a case, the best solution would be to create a www.theirdomain.tld server. In VM I will get a "The domain name does not need to have www at the start" message. Which is very peremtory ;) and, in that case, false. Thanks to the "server's featrures" flexibility we can declare a theirdomain.tld server and set it to do what we want but in a very confusing way. A theirdomain.tld appears in the list of the "domains" we host while we do not serve this domain at all... Even worse, Apache is configured to serve it, hopefully "patched" using an alias www.domain -> domain.

I don't know how deep all this is planted in the VM's code but I think "accounts" and free server's declaration would clarify the concepts, standardize (~/domains) web sites management and make sub-domains useless. Most of the extra conceptual complexity introduced by normalization could be easily hidden to hosing-newbies with a couple of preselected dash boxes.

VM is a great software and i have much respect for all the people who contributed to it and keep it so alive.

Wed, 07/13/2011 - 03:22
Locutus

Your explanation of the term "subdomain" sounds correct, but that's not really the point in this discussion.

Virtualmin simply has a different philosophy about what it considers a "server" and a "sub-server" (as I outlined in post #2) and what kind of domain name goes with it.

If you wish to forbid creation of sub-servers that have unrelated domain names, you can do so in the Server Plan settings.

Wed, 07/13/2011 - 14:30
Locutus

Hmm.. Please check the last paragraph of the second post in this topic here. What detail exactly about sub-servers is still unclear?

(And yep, sub-servers are very useful, at least I find them to be.)

Thu, 07/14/2011 - 09:43
Locutus

Okay, what's not clear about what they do? As I wrote in the second post, they are servers that share administrative user with their parent and whose data directory is located under the parent domain. That's it.

I use them to structure my servers. Furthermore, non-root Virtualmin users can be allowed to create sub-servers under their servers, optionally with domain names that must be subdomains of their parent server domain. They also can be assigned a different set of server templates.

I really don't know what else to say.

Thu, 07/14/2011 - 13:09
andreychek

Creating a sub-server under myexample.com's virtual server for the purpose of hosting myexample.net seems weird IMHO. The two don't actually go together. They are separate domains, and in no way related. Since the basic setup allows for IP sharing, it isn't necessary for that purpose, is it?

All a "Sub-Server" means is that it's a domain that's part of one user's account. It doesn't imply the domains are related in any way, other than the domains being owned by one user.

The domains are stored in a separate directory, and are treated quite differently by Virtualmin.

What it does mean, is that one single user has control over all of them -- and if that user logs into the server via FTP, they can make changes to any domain that they want, if they go into the domain's directory.

-Eric

Thu, 07/14/2011 - 17:25
Locutus

KitchM, I explained three times already that "sub-server" means that it shares the administrative user of a parent server and its files are located under that parent server's directory. I have no idea what is not to be understood about that.

If you wish to keep "example.com" and "example.org" separate, and don't need common user and directory structure, then go ahead and do so. But if one wishes to group virtual servers owned by the same person, no matter if it's "blahblah.com" or "blehbleh.org", giving them access to all the files in those domains with one login and in one place, one uses sub-servers.

Fri, 07/15/2011 - 04:08
Locutus

But I'm beginning to understand (and I hope I'm right here) that subservers can be given administrative user's "access rights" and privileges.

Not only "can they be given" those access rights, they automatically and irrevocably have them.

It's nothing magic. Nothing fancy. Nothing exotic. Sub-servers home directories get created under the home directory of an existing parent server, in a folder named "domains", and they do not get a separate owner user. Thus their file ownership shares that of the parent. That's it.

I really don't see what's the big fuss about this and how one could write pages and pages of text about this simple matter, and still not really grasping what happens. :P

If you're uncertain about things, just install Virtualmin in a test system and try this stuff out, that's how I learn(ed) most of it myself.

Thu, 05/24/2012 - 02:29
kotakomputer

Virtualmin must implemented Sub-Domain beside Sub-Server. Let's me make it clear.

  1. CPanel not only provides SUB-DOMAIN but also SUB-SERVER
  2. Virtualmin previously support Sub-Domain then change it to Sub-Server

Now, Virtualmin should bring both back: Sub Domain and Sub Server to fix their mistake :)

And the important thing as like other say: Virtualmin must use general term which has been used by CPanel, Direct Admin, Pleks, Kloxo, ISPconfig, etc.

Thu, 05/24/2012 - 03:57
ronald
ronald's picture

If CPanel implemented sub-server now (as they didnt a few years back) that can only mean they come to realise that sub-domain is a wrong approach and they have learned from panels like virtualmin.

virtualmin still supports the subdomain but correctly promotes subserver as the favourite son.

Sun, 05/27/2012 - 12:13
kotakomputer

CPanel supports both Sub-server and Sub-Domain while Virtualmin only support sub-server now.

Note: this is not a new CPanel feature, but already implemented years ago. That is why CPanel is the most popular even CPanel is not free, because people need this feature and CPanel have it :)

Sun, 05/27/2012 - 14:21
ronald
ronald's picture

sub-domain can be used in virtualmin. you just need to enable it under virtualmin - System settings - Virtualmin Configuration - Advanced Options - Allow creation of sub-domains? and set this to yes.

5 years ago when i used cpanel extensively i have never seen any feature like subserver but that could be that i just never saw it. Subdomains yes, that was always there.

Fri, 12/14/2012 - 11:38
zylnia

Hello,
i see 3 solutions tell me if i am wrong

1/
http://www.robilim.com/article-item/14/htaccess-301-force-redirect-direc...
This one causes 301 redirect which okay but not ideal for SEO
2/
http://systembash.com/content/simple-redirect-subdomain-to-a-directory/
this on causes 302 redirect which is worse for SEO
3/
create a virtual server that would not need the 301 redirect (for SEO purpose that'd be the best solution?
we have a direct mapping, best for SEO?

Thank you for your feedback !

Fri, 12/14/2012 - 17:02 (Reply to #26)
zylnia

SEO = search engine optimisation it is not wise to make 302 redirect (temporary redirect) it is ok to do 301 redirect because the search engine will figure out it's a permanent move, your ranking may be moderately impacted the best solution is to create a virtual server that maps exactly to the subdomain

Sat, 12/15/2012 - 13:06
tpnsolutions
tpnsolutions's picture

Hi,

While Sub-Servers (sub-domains) are far more superior in Virtualmin over the way cPanel does Sub-Domains, it's possible to enable the cPanel way, though keep in mind this feature may not work as well, and may be removed in a future version of Virtualmin.

First off, before you follow the below steps, please read:

http://www.virtualmin.com/documentation/system/cpanel#creating_a_sub-domain

== ENABLING CPANEL SUB-DOMAINS ==

The option is off by default, however you can accomplish the task of enabling cPanel style sub-domains by going to:

Virtualmin > System Settings > Virtualmin Configuration > Advanced Options

Look for the setting "Allow creation of sub-domains?", and change to "Yes".

Once again, this will enable cPanel style sub-domains, but in retrospect, just because another program chooses to do things this way, does NOT mean it's the best or superior way of doing things. Personally, I prefer Sub-Servers as I find them more powerful, and the isolation of things is quite nice.

-Peter

Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Topic locked