Confusion about sub-domains

Hi there,

I do remember reading something somewhere in the documentation about recommending that the option to host sub-domains be disabled because of possible confusion of the end user, but I do use sub-domains and I'm the one confused.

I added example.com to Virtualmin, and then added wiki.example.com as a "sub-domain of example.com", not a "sub-server". I expected to see a path and skeleton files created at /home/example/domains/wiki.example.com/public_html, but there was no "public_html" directory. So I deleted the sub-domain in Virtualmin and re-added it, and the expected path was created, albeit with missing "icons" and "stats" directories, but with the two files in /etc/skel.

I then added content, and loaded the sub-domain in my browser, but I got the skeleton "index.html" page instead of what I expected. Thinking I must have forgotten to delete the skeleton index page, I went back and looked. It wasn't there.

After some poking around I ended up at Virtualmin | Server Configuration | Website Options for wiki.example.com and the "Website documents sub-directory" is /home/example/public_html/wiki (and there are skeleton files there too) instead of where I expected it to be at /home/example/domains/wiki.example.com/public_html.

There are three problems here:

  1. Virtualmin set up the same sub-domain two different ways on two different attempts. This doesn't make sense.
  2. Why is the document root at /home/example/public_html/wiki instead of /home/example/domains/wiki.example.com/public_html?
  3. I then tried to change the ""Website documents sub-directory" from /home/example/public_html/wiki to /home/example/domains/wiki.example.com/public_html, but I got this error: "Failed to save website options : Website documents sub-directory cannot start with or end with /". However, the default path begins with a forward slash (which only makes sense, seeing as it starts with "/home" off the root), and the path I entered started out in the identical manner and did not end with a forward slash.

I then went to Virtualmin | Services | Configure Website | Edit Directives. I started to configure Apache that way I expected it to be configured, but then I realised I was heading down a path where I was clearly acting against the will of Virtualmin (considering it has put a "wiki" sub-directory in other weird places too, like the "cgi-bin" directory), so I thought I'd better ask here first.

Considering Virtualmin seems to be undecided about the path to create for a sub-domain, which one is the correct one? If the correct one is /home/example/public_html/wiki, why? Why is it not /home/example/domains/wiki.example.com/public_html? And why can't I change it at Virtualmin | Server Configuration | Website Options?

Thanks.

Craig

Status: 
Closed (works as designed)

Comments

Joe's picture
Submitted by Joe on Mon, 03/21/2016 - 04:56 Pro Licensee

  1. Don't use the sub-domains feature. Set it back to disabled. You don't need it and you don't want it, based on your description of what you expect to see, and want to see.
  2. Use the sub-server feature. It does what you want and what you expect (and is what you used in one of your experiments, which is why things looked different in terms of directory layout).

A sub-domain puts things into /home/domain/public_html/sub-domain-name

A sub-server put things into /home/domain/domains/sub-server-nme

A sub-server is nice. Has many features. And makes sense (generally speaking, though there's room for debate about some of the choices we make by default, most of those are configurable).

A sub-domain is ugly, has limited features, and only exists because we had a lot of people come over from cPanel in the early days and they really wanted a "sub-domain" and they wanted it to act the way it acted on cPanel. This was a bad idea, and we should have never implemented it. Thus we hide it. It has to be enabled for it to even show up as an option. There is no cure for how wrongly designed the sub-domain is; cPanel does some things well, this is not one of them.

Finally, to be clear: To have a website that is a subdomain of one of your existing domains in Virtualmin you do not need the create a "sub-domain" virtual server. The name doesn't matter. You can make a sub-server with a subdomain name. Or you can make a new parent virtual server with a subdomain name. Names don't matter to Virtualmin. You do not need the sub-domain feature to be enabled, at all, and we recommend you don't use it, at all.

Hi Joe,

OK, that's pretty clear. Perhaps that's what the documentation I read said. I'll have another go in the morning, but for now I'm going to bed. :)

But I swear that I created a "sub-domain" both times, not a "sub-server" on one occasion. Based on what you say and my experience creating other non-sub-domain sub-servers, if I had created a sub-server the first time I would have got what I expected.

Thanks. I'll confirm success later this morning.

Craig

I created the sub-domain as a "sub-server" and all is right with the world. I'll go and find the setting to disable the "sub-domain" option.

Craig

Joe's picture
Submitted by Joe on Mon, 03/21/2016 - 16:12 Pro Licensee

Status: Active ยป Closed (works as designed)

Cool. Glad we got that sorted out.