Strange webserver directory structure

25 posts / 0 new
Last post
#1 Sat, 12/26/2009 - 17:16
jo

Strange webserver directory structure

I'm probably missing some important concept here, so here goes:

The first virtual server (domain) that I create for a new user has its DocumentRoot on /home//public_html/. Any subsequent servers (domains) are considered "subservers" (huh? what if the user drops the main domain and wants to keep the others?) and have their respective DocumentRoots on /home//domains//public_html/. That's a redundant "domains" (public_html has a per-domain subdirectory anyway) and a redundant .

I guess I'm unclear about the subserver concept, but I found no way of establishing a second main server for an existing user.

So, any enlightening words appreciated :)

Sat, 12/26/2009 - 17:44
ronald
ronald's picture

does the user have enough rights to create top level domains? this is set in the account plans..

Sat, 12/26/2009 - 18:15
jo

The user does not have the right to create any domains at all, nor should he :)

I'm creating the user and domains from the root account at this time. (I suppose that root can do anything, right?)

[UPDATE] I just found that a subserver would be totally wrong actually, they are not supposed to manage new domains (they could add subdomains if they want, that's all). So, I need to give the same user multiple virtual servers, no subservers. I'm not sure how to do this, I guess I'll take another look tomorrow.

Sat, 12/26/2009 - 18:57
ronald
ronald's picture

you can create a subserver as a "subdomain" as well as a top level server. It doesn't matter to Apache.
It matters only to the owner, wether the subserver has the same login credentials as the main domain (residing in /home/user/domains) or it has its own login credentials (residing in /home/).

You can tune the settings for "They" in the Account Plans

Sun, 12/27/2009 - 04:50
jo

True that it matters only to the domain owner, but they already have to jump through too many hoops. (I'm serving the less knowledgeable end of the spectrum, so I need to make things as simple as possible for my users.)

There's a showstopper there, too: if the first domain goes away, when I delete the first virtual server, the subservers will be deleted, too. Ouch. I could work around that (simply leave the first server active but disable it, for example), but (a) that would irritate users, and (b) Virtualmin might maintain other connections between main server and subservers, now or in the future.

That all leads me to believe that subservers are just a bad idea for my use case.

Sun, 12/27/2009 - 05:11
ronald
ronald's picture

sub servers will not be deleted if you create them as top level servers though and have their own zonefiles (so not add them to the parentzone in the template).

Sun, 12/27/2009 - 05:41
jo

How do I create a server as top-level server?

When I select an existing user and click on "Add new virtual server, owned by:", I get a subserver.

Sun, 12/27/2009 - 06:06
ronald
ronald's picture

when you click Create virtual server, then in the right pane at the top you can choose Top level server.
However this needs to be enabled in your server template.

virtualmin - system settings - server templates, choose the template you are using, in the dropdown - Basic settings and Usage, look at For use by and enable your choices.

Sun, 12/27/2009 - 07:10
jo

Every "For use by" checkbox in the templates is checked, still I can't choose Top Level Server.

I have "Add new Server, owned by:", the drop-down list, "Import virtual server", and "Migrate Virtual Server". When I click on "Add new Server" and have a user selected, I get the "Create Virtual Sub-Server" screen.

[UPDATE] Or is "Create new virtual server" a separate option somewhere?

Sun, 12/27/2009 - 08:14
ronald
ronald's picture

add servers is for importing/migrating servers.
do you have the blue virtualmin framed theme selected?
Create Virtual server is in the left column on the top see attachment

Sun, 12/27/2009 - 09:10
jo

> do you have the blue virtualmin framed theme selected?

That was it.

Hmm. That new top-level server needs a new user name. That's not what I need - one user may own multiple virtual servers.

So I guess for user joe I'll have to create joe.hoster.com as top-level-server that's never deleted (and never too useful), and Joe's domains will live as subservers.

This should actually work, just not the directory structure I want.

Here's what I want:

home
joe
awstats
cgi-bin
logs
mailusers
public_html
joe.hoster.com -- dummy domain
joes-family.org -- Joe's first domain
joes-company.com -- Joe's second domain

Here's what I get:

home
joe
awstats
cgi-bin
logs
mailusers
public_html
joe.hoster.com
domains
joes-family.org
awstats
cgi-bin
home
joe
domains
joes-family.org
public_html
joes-family.org
logs
mailusers
joe-inc.com
awstats
cgi-bin
home
joe
domains
joes-inc.com
public_html
joes-inc.com
logs
mailusers

The webserver thinks that the root directories are at /home/joe/domains/public_html/joes-family.org and /home/joe/domains/public_html/joes-inc.com, respectively, which don't even exist.

Now this is utterly confused.

Sun, 12/27/2009 - 10:06
ronald
ronald's picture

I think your previous attempts made your structure incorrect.
the subservers and aliases should neatly be in /home/joe/domains
/home/joe/domains/joes-family.org
/home/joe/domains/joes-inc.com
/home/joe/domains/joe.hoster.com

per haps delete the virtual server and start over but this time with the correct theme and through the correct Create Virtual Server option.

You can alway try to symlink it into the main public_html but that structure is more of a cpanel approach

Sun, 12/27/2009 - 10:31
jo

Symlinking would also need to be done manually, and it would confuse FTP clients, or the users sitting in front of them.

Creating the top-level server does not create a domains subdirectory in /home/joe, it does create a /home/joe/public_html directory.

It also generates the DocumentRoot as /home/joe/public_html/joe.hoster.com, which does not exist as a directory.

Further, running Virtualmin's validation gives:
Home directory : Sub-directory public_html/joe.hoster.com under home directory does not exist
Apache website : Missing Apache block for HTML directory /home/joe/public_html/joe.hoster.com

The second message is probably just a symptom (and the situation is harmless anyway), the first seems to point to some misconfiguration / incomplete implementation in Virtualmin.

Is there a good way to get a listing of all configuration changes from the installation default?

Sun, 12/27/2009 - 17:52
ronald
ronald's picture

Creating the top-level server does not create a domains subdirectory in /home/joe, it does create a /home/joe/public_html directory. That's correct. a domains subdirectory is created when you create a subserver as a sub server.

It also generates the DocumentRoot as /home/joe/public_html/joe.hoster.com, which does not exist as a directory. that sounds like a misconfiguration or a bug which you can submit to the bugtracker.
Seeing the error, do you have subdomains enabled in the "system settings - module config - advanced options"?
I advice to turn that off.

Mon, 12/28/2009 - 03:47
jo

that sounds like a misconfiguration or a bug which you can submit to the bugtracker.

Where is the bug tracker? It seems to be more than two clicks away from http://virtualmin.com, at least I didn't find it there.
...found it: it's under "issues" if you're logged in. (Things being hard to find - is that a recurring theme? I was having trouble with that in Webmin and Virtualmin, too.)

I'm currently reinstalling Virtualmin but I have a backup of the settings in an archive file. So I could submit a bug report, I just won't be able to follow up with new information if requested - does it make sense to submit under these circumstances?

Seeing the error, do you have subdomains enabled in the "system settings - module config - advanced options"?

Don't know, I'm currently reinstalling Virtualmin from scratch.
(I could look it up in the archived configuration, but I don't know how to map Virtualmin page elements to Virtualmin configuration file lines.)

I advice to turn that off.

Why?

I have seen the advice against it in the Virtualmin docs ("little benefit and confusing to users"), but it can be useful to put e.g. forums under forums.domain.tld.
It is confusing and without benefit if forums.domain.tld is under .../domains/domain.tld/forums/, but put the forums in a separate .../domains/forums.domain.tld/ and everything is fine for both domain owner and visitors.

Mon, 12/28/2009 - 08:02
andreychek

Where is the bug tracker?

You can find the bug tracker using the Support link at the top of each page.

So I could submit a bug report, I just won't be able to follow up with new information if requested - does it make sense to submit under these circumstances?

Sure, Jamie can still take a look at the code around where the problem is, something may stand out as the issue.

Why?

I have seen the advice against it in the Virtualmin docs ("little benefit and confusing to users"), but it can be useful to put e.g. forums under forums.domain.tld. It is confusing and without benefit if forums.domain.tld is under .../domains/domain.tld/forums/, but put the forums in a separate .../domains/forums.domain.tld/ and everything is fine for both domain owner and visitors.

Agreed, being able to use forums.example.com is nice.

Also, the Sub-Servers idea really did cause a lot of confusion, as implemented (and named), and they were disabled by default due to how much trouble they caused versus how much benefit they provided.

All that said -- I don't really disagree that some folks would want sub.example.com to appear in the same directory hierarchy as example.com. A case could certainly be made for (optionally) keeping domains and sub-domains together. I'll chat with Joe to get his thoughts on the matter :-)

-Eric

Mon, 12/28/2009 - 11:04
ronald
ronald's picture

It is confusing and without benefit if forums.domain.tld is under .../domains/domain.tld/forums/, but put the forums in a separate .../domains/forums.domain.tld/ and everything is fine for both domain owner and visitors. It is suppose to go under ../domains/forums.domain.tld/ just as you expect it.
It just didn't do it for you and I suspect this is either a bug or because you have tried to get the subdomain feature to work which went off scale.

There is a thread here with an explanation by Joe
http://www.virtualmin.com/node/6697

Thu, 12/31/2009 - 06:30
jo

Ah. I finally came around to reading Joe's explanation.
Yeah, the way cPanel handles it is confusing; however, Virtualmin is quite confusing here, too:

  • Virtualmin says "sub-domain" where it means "cPanel-style sub-domain"; I understood the term to mean "DNS subdomain", which is part of what a cPanel-style sub-domain is, so the mistake wasn't even immediately obvious. (Suggestion: rename the option to "cPanel-style sub-domain", and change the explanation of the option to mention that the subdomain gets to reside in a subdirectory of the superdomain, which is a bad idea in general unless you need to accommodate cPanel migrants.)
  • Virtualmin creates a "domains" directory for subservers. This is just silly - why should one server live in public_html/domain.tld, but all other servers in public_html/domains/other_domain.tld, public_html/domains/forums.domain.tld, etc?
  • Virtualmin's "virtual servers" aren't virtual servers at all. Or, put another way, Virtualmin is introducing yet another meaning to the term "virtual server" above and beyond what we already have (chrooted virtual servers, VM'ed virtual servers, name-based Apache virtual servers, IP-based Apache virtual servers, DynDNS virtualization of IP address). In my eyes, Virtualmin is offering a way to manage domains and associated webspace, mail service, and FTP access - and that's exactly what our users need, who couldn't care less about what kind of server is providing these services. (Of course, I know that changing terminology now is probably infeasible, and it's really just a nit to pick. Still, I find it a bit strange that Virtualmin is promoting its terminology as being cleaner and superior to cPanel's terminology - it's just the opposite, only that Virtualmin offers better directory organization which is more important anyway.)
Thu, 12/31/2009 - 11:17
ronald
ronald's picture

the structure is:
/home/*/public_html/
and for subservers and aliases
/home/*/domains/forum.domain1.tld
/home/*/domains/shop.domain2.tls
/home/*/domains/aliasdomain1
/home/*/domains/aliasdomain_etc

aliases can have their own email and website too
subservers have their own structure just like a toplevel domain including its own php.ini
that's why it doesn't reside in the way cpanel does it.

it's also easier than to put all your subservers and aliases into 1 public folder imo.
If your structure isn't like that than likely there is something wrong in your set up.

Thu, 12/31/2009 - 22:06
jo

Aaahh... right... I correct:
The main domain should be under /home/*/domains, too.
Or maybe Virtualmin should do away with the notion of a main server, and promote all subservers to a "normal server" status.

Let me sum up my line of reasoning:

  • Deleting the main server deletes all subservers.
  • Users may acquire and drop domain names in any order. So the first domain name that the user acquires cannot be assigned to the main server, because as soon as the user drops that domain, all other subservers and hence domains of that user will be deleted together with the main server.
  • So the main server needs to be assigned a dummy domain name that has two functions: 1) ensure that the subservers stay in existence, 2) provide default settings for subservers.
  • A conceptually easier way to handle this would be to demote the main server into a list of default values, and promote the subservers to "normal server" status. The distinction between main server and subservers would go away.

So I'm wondering why Virtualmin is still having that notion of main server and subservers.

Sun, 01/03/2010 - 07:43
ronald
ronald's picture

Because subservers can be created as a top level server too, making your points invalid. It will then be and act as a top level server even after you have deleted the main server provided you have given the subserver its own host file and the main domain or just the subdomain is still pointing to your server with an A record (enforcing your last point).
So it's:
/home/sub.server.tld/public_html
/home/server.tld/public_html

Also you can choose where your main server resides, I believe this is done in the module config or in the server template, change /public_html to /domains/public_html

This is one of the strong points of virtualmin, you can set it up the way you want.

Sun, 01/03/2010 - 09:13
jo

So it's /home/server.tld/public_html

Only if you make server.tld a Unix user name. Unless you really meant /home/joe/public_html/server.tld.

Also you can choose where your main server resides, I believe this is done in the module config or in the server template, change /public_html to /domains/public_html

Hm... yeah, I could do that.

It would also keep all the auxiliary directories and files (awstats, .awstats-htpasswd, cgi-bin, logs, homes, .stats-htpasswd) out of the home directory.

I still don't see how to create subservers as toplevel servers. I don't have any host files here, bind runs as a caching-only server and relies on external nameservers to resolve the locally hosted domains. (Less interference that way because we're managing DNS through an external provider.)

This is one of the strong points of virtualmin, you can set it up the way you want.

No, I can't do away with the "domains" subdirectory ;-P (I think it's hardcoded.)

Sun, 01/03/2010 - 09:48
ronald
ronald's picture

"Only if you make server.tld a Unix user name. Unless you really meant /home/joe/public_html/server.tld."
When you create a domain, you can change the administration name to joe if you want, but it doesn't matter. its then /home/joe/public_html
The main point is that the index.php resides in public_html not /public_html/server.tld/index.php

As for the auxiliary files, I dont know about that as I haven't tried to switch /public_html to /domains/public_html myself

If you cannot create subservers as top-level domains, I think you have a bug or misconfiguration still. You don't have the link on top of the screen as in my image I posted above?
Resolving should still work if you have an A record pointed to your server at the registrar or your dns provider.

The "domains" folder is created when you create a subserver or alias belonging to the main server. Else it is not there.

Sun, 01/03/2010 - 12:11
jo

The main point is that the index.php resides in public_html not /public_html/server.tld/index.php

Yep, that was clear. I was just surprised to see /home/server.tld/public_html . I have Virtualmin set up so that it takes the first part of the domain name as the default user name, and are currently settled for establishing a standard domain such as username.testdomains.hoster.tld so they have somthing to play with.

If you cannot create subservers as top-level domains, I think you have a bug or misconfiguration still. You don't have the link on top of the screen as in my image I posted above?

I have the link, but I can't create a top-level server for an existing Virtualmin user account: it's asking me to enter a new user name, or generates one from the domain name if I don't enter a name, or bails out with an error if I explicitly enter an existing user name.

As for the auxiliary files, I dont know about that as I haven't tried to switch /public_html to /domains/public_html myself

Oh, right. That would make moving the top-level server to a different directory pointless. I'll try that then.

Resolving should still work if you have an A record pointed to your server at the registrar or your dns provider.

Of course. That's the registrar, and wholly unaffected by Virtualmin; DNS is not causing any issues here. I'm trying to set up things in a way that (a) all domains of a user can be created and deleted independently (b) all domains of a user reside in the same subdirectory.

Sun, 01/03/2010 - 16:14
ronald
ronald's picture

I have the link, but I can't create a top-level server for an existing Virtualmin user account: it's asking me to enter a new user name, or generates one from the domain name if I don't enter a name, or bails out with an error if I explicitly enter an existing user name. that sounds wrong to me. Did you submit a ticket for this? (support-link on top of forum)

Topic locked