Where to begin: One user many sub-domains.

14 posts / 0 new
Last post
#1 Tue, 04/14/2009 - 10:31
steward

Where to begin: One user many sub-domains.

CentOs 5.2 fresh install webmin and virtualmin 3.67

I have several sub-domains eg

my.site.com foo.site.com fie.site.com

There is only me here, no other users. The box is all mine. I'll be developing the sites, and they will have shared code (CodeIgnitor framework), so I would prefer a directory structure like, eg

/home/domains/public_html/my /home/domains/public_html/foo /home/domains/public_html/fie

I am experimenting and learning a little, but I created one domain, then deleted it, and I see "leftovers" in the file system which make me nervous. I fiddled with creating a new template but...

...basically I am ignorant.

What is the fastest way to set this up so I can create and delete virtual hosts that are all owned by the same user, and all branch off the same parent folder?

I am hoping there are few simple steps and someone here could list them briefly.

Many thanks in advance.

Tue, 04/14/2009 - 12:04
steward

Seems like... virtualmin wants every new domain to belong to a new user. Not sure how to get all domains to belong to one user...

Tue, 04/14/2009 - 12:37 (Reply to #2)
sfatula

Check this out, very common question:

http://www.virtualmin.com/documentation/id,virtualmin_for_cpanel_users/

It's quite easy actually. Just different terms than cpanel and others use. Read the section titled "create sub-domain".

Tue, 04/14/2009 - 12:06
steward

Also note: "site.com" is already livbe and running on a different box.
All I want here are subdomains (f..site.com, fie.site...)

Tue, 04/14/2009 - 15:36 (Reply to #4)
Joe
Joe's picture

<div class='quote'>Also note: &quot;site.com&quot; is already livbe and running on a different box.
All I want here are subdomains (f..site.com, fie.site...) </div>

Hopefully the doc sfatula directed you to will make things more clear, but I did want to call this one out as it seems to be a common source of confusion for folks coming from cPanel, as it seems to impose weird artificial restrictions onto names.

Virtualmin does not care what you name things. Saying this is like saying, &quot;Also note: there are already websites on the Internet. I want to name mine something different.&quot; They're all just names. sub.domain.tld is a name, and so is domain.tld. Virtualmin doesn't care what you name things. Name it sub.sub.sub.sub.domain.tld for all Virtualmin cares. ;-)

--

Check out the forum guidelines!

Tue, 04/14/2009 - 14:08
Joe
Joe's picture

<div class='quote'>I am experimenting and learning a little, but I created one domain, then deleted it, and I see &quot;leftovers&quot; in the file system which make me nervous.</div>

Can you be more specific about these leftovers? Assuming you told Virtualmin to clean up everything, it shouldn't have left anything behind.

--

Check out the forum guidelines!

Thu, 04/16/2009 - 09:33
steward

Appreciate the replies thank you, and I'll get back with more info.
But I am still stuck on question one.

When I attempt to create a virtual server, it fails due to &quot;The specified administration user already exists&quot;.

I own all the domains, I don't want multiple accounts. I'd like it if all my sites belonged to me.

I can easily change things &quot;after the fact&quot; by chowning and chmodding etc, but have no idea what effect this is going to have on Virtualmin as I go forward.

Thu, 04/16/2009 - 13:09 (Reply to #7)
Joe
Joe's picture

<div class='quote'>When I attempt to create a virtual server, it fails due to &quot;The specified administration user already exists&quot;.</div>

You're doing it wrong. ;-)

Create a sub-server if you want a server that is owned by an existing virtual server account. That's what that document sfatula pointed you to is all about.

--

Check out the forum guidelines!

Thu, 04/16/2009 - 10:28
tpnsolutions
tpnsolutions's picture

Hi,

In theory (and I'm sure Joe will correct me if I'm wrong), if you setup &quot;my.domain.com&quot; as a &quot;top-level&quot; domain, you would assign a username/password to this user.

Then if you setup &quot;foo.domain.com&quot; as a &quot;sub-server&quot; it would share the same credentials as &quot;my.domain.com&quot; therefore saving you from having to create multiple user accounts.

If you are then trying to use a common framework between the domains then you could do some fancy apache work by using directory aliases between the domains or similar. This would save you having to have the same files in both directory trees as noted below, and in theory should work since the domains are owned by the same linux user.

Just for reference the domains would be stored in a structure like:

/home/domain/public_html (my.domain.com)

and

/home/domain/domains/foo.domain.com/public_html (foo.domain.com)

(assuming you haven't changed the template from the default)

I hope this helps, and more importantly makes sense.

--
Best Regards,
Peter

Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Thu, 04/16/2009 - 10:30 (Reply to #9)
tpnsolutions
tpnsolutions's picture

Actually instead of apache doing the aliases, you could also in theory do this at the system level, assuming you have the proper rights to do so.

--
Best Regards,
Peter

Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Fri, 04/17/2009 - 08:43
steward

[1]
So there is no way to assign a server to an existing user?
Virtualmin always creates and manages the user account?

I own the boxes, my account already exists.

I guess I save my stuff, delete my account, log in as root and then let Virtualmin re-create it?

[2]
<div class='quote'>
Saying this is like saying, &quot;Also note: there are already websites on the Internet. I want to name mine something different.&quot; ...
</div>

What I said was I wanted to name it the SAME. Not different. The parent domain exists live elsewhere. Code will come from SVN into either box, and the folder structure had better match. The point here is to avoid &quot;fancy&quot; apache aliasing, rewriting, symlinks and additional levels of complexity.

A single simple folder structure has proven effective on my test machine (WIN/XAMPP). Just trying to translate it into CentOS.

The parent site and subdomains encompass three servers (and more to come).

[3]
I think perhaps the gentlemen who suggested doing it manually had the right idea. It's a question of how much time to invest figuring out how this thing behaves. The easy interface is great.

I can probably get the folder structure I want by tweaking templates and an afternoon of trial and error. I'll use subdomains to force Virtualmin to keep the same owner. Maybe.

I know exactly the end result I want, and won't settle for less due to a limitation of some admin tool. I have suffered with that for too long under various hosts! Now the boxes are all mine.

Question remains. Once you start fiddling around OUTSIDE Virtualmin, what damage will you do eighteen months down the road...? What are the traps?

[4]
The &quot;leftovers&quot; were mostly red herrings. After &quot;updatedb&quot; they went away, except for the logs :(

===
/domains/mysite/public_html (mysite.com on server X)
/domains/mysite/public_html/foo (foo.mysite.com on server Y)
/domains/mysite/public_html/fie (fie.mysite.com on server Y or Z...)

It's that simple.

Virtual servers so that software can pick apart HTTP_HOST to determine where it is.

===
I appreciate the answers and your patience. Thank you.

Fri, 04/17/2009 - 10:30 (Reply to #11)
Joe
Joe's picture

<div class='quote'>[1]
So there is no way to assign a server to an existing user?</div>

Of course there is. But they'd have to be Webmin users (system users don't have any information about Webmin capabilities...we can't just automatically make all system users into Webmin users, as Webmin is an administrative level tool with root-level powers, by default). So, turn those users into Webmin users, and you can then assign virtual servers in Virtualmin to them.

That said, you might be on the wrong track for what you're actually trying to do (I'm not sure).

<div class='quote'>Virtualmin always creates and manages the user account?

I own the boxes, my account already exists.

I guess I save my stuff, delete my account, log in as root and then let Virtualmin re-create it? </div>

Maybe what you actually want are additional root-level users? In many situations when someone says, &quot;staff&quot;, they're talking about system administrators within the company who should have access to everything. If that's the case, you'd want to make all of your staff into Webmin users with root-level permissions, including Virtualmin. Which makes them &quot;owners&quot; of all virtual servers.

<div class='quote'>What I said was I wanted to name it the SAME. Not different. The parent domain exists live elsewhere.</div>

That's not the same. Every sub-domain is a different name. Virtualmin doesn't care about names. That's what I'm trying to explain. Virtualmin does not care what you name things (though there are the automatic aliases that might get in the way, if you wanted to have separate virtual servers for, say, svn.domain.tld, www.domain.tld, and ftp.domain.tld that actually pointed to different virtual server homes--that seems rather an unintuitive use of things, but I guess it could happen).

But, joe.virtualmin.com is not the same as jamie.virtualmin.com. And neither is the same as virtualmin.com. Names don't matter to Virtualmin. joe.virtualmin.com is as different from virtualmin.com as it is from joe.webmin.com. None of these names are the same, and I could have a virtual server or a sub-server or an alias named each of these things. All would work. None have to be a special &quot;sub-domain&quot; type of account for this to work.

That said:

<div class='quote'>Code will come from SVN into either box, and the folder structure had better match. The point here is to avoid &quot;fancy&quot; apache aliasing, rewriting, symlinks and additional levels of complexity.</div>

I don't understand what this means.

What is &quot;fancy apache aliasing&quot;? I haven't suggested any aliasing.

<div class='quote'>Question remains. Once you start fiddling around OUTSIDE Virtualmin, what damage will you do eighteen months down the road...? What are the traps?</div>

I don't recommend you mess around outside of Virtualmin.

<div class='quote'>
/domains/mysite/public_html (mysite.com on server X)
/domains/mysite/public_html/foo (foo.mysite.com on server Y)
/domains/mysite/public_html/fie (fie.mysite.com on server Y or Z...)
</div>

This is a cPanel style &quot;sub-domain&quot; account layout. I can't think of a single benefit to this way of doing things. There used to be such an account type in Virtualmin, but it was deprecated because it confused way too many people.

<div class='quote'>It's that simple.

Virtual servers so that software can pick apart HTTP_HOST to determine where it is.</div>

Every single virtual server in Virtualmin is a virtual hosted server. Everything uses name-based virtual hosting. Virtual servers use it, sub-servers use it, and aliases use it. There is no way to make a website in Virtualmin that does not pick apart HTTP_HOST to determine where it is. What you're talking about is whether we do things the cPanel way, or not. And the answer is, &quot;We don't.&quot; And the reasons are explained on the document linked by sfatula earlier.

So, all that said, I'm confused about why the concept of sub-servers is making you feel so frustrated...but sub-domain style accounts would not? A sub-server is simply a virtual server owned by an existing virtual server owner. It can be named with a sub-domain name (you can even enforce that naming requirement...so you can create a virtual server &quot;virtualmin.com&quot; and make it so that he can only create sub-servers named &quot;something.virtualmin.com&quot;).

The only difference from what you've said you want is a slightly different directory structure.

cPanel style sub-domains look like:

/home/domainname/public_html/ (&quot;domainname&quot; domain)
/home/domainname/public_html/foo (&quot;foo.domainname&quot; domain)

Virtualmin sub-servers look like:

/home/anyname/public_html/
/home/anyname/domains/othername/public_html

Sub-servers can be named anything, as can the parent domain (again, Virtualmin doesn't care about names). Sub-servers are owned by an existing virtual server admin, and that's all that &quot;sub-server&quot; really means--a domain owned by an existing account and living within the home of that existing account. This directory structure describes a site named anyname, with a sub-server named othername that is owned by anyname.

Note that this <i>can</i> be:

/home/domainname/public_html (&quot;domainname&quot; domain)
/home/domainname/domains/foo/public_html (&quot;foo.domainname&quot; domain)

Which mirrors the cPanel style subdomain account type...with the exception that in Virtualmin each sub-server can have it's own everything because it's not cramming the subdomain into the web directory of the parent; meaning, you can run different PHP environments, have different mailboxes, have different SVN repos, have different configurations for pretty much any feature (but you don't have to).

The thing is that I think we're talking past one another here. What is it that you're trying to accomplish that requires your additional sites to live within the public_html of the higher level domain? I just can't think of any benefits to that (not to mention it makes &quot;foo&quot; visible on domainname.com/foo/, which means Google is going to see two copies of your site foo, which is a spammy characteristic and costs you ranking).

But, I'm thinking it just comes down to getting past the idea that names matter to Virtualmin (or Apache, or BIND, etc.), or that foo.domain.com and fie.domain.com has some deep unbreakable connection to domain.com. They don't. It's all just names, and everything is a subdomain of something (virtualmin.com is a subdomain of the .com TLD...this doesn't mean I have to have it live in /home/com/public_html/virtualmin).

Again, maybe I'm just completely missing why you want this particular directory layout. But, I do want to make clear we are talking about directory layout here, and nothing else. All of these things are VirtualHost sections in the Apache config file (except aliases, which are ServerAlias directives).

--

Check out the forum guidelines!

Sun, 06/07/2009 - 07:51
steward

Ya, talking past each other.

I have existing software which requires this particular web folder layout to handle subdomains and share code. The benefits to me are enormous.

I don't care about google or page ranks or SEO. NOINDEX,NOFOLLOW and get off my sites.

I have no users (webmasters, virtual staff, whatever). Only me here.

Don't know about cPanel. Heard about it. That's all. Virtualmin looked like a better solution.

I was just looking for a quicky tool to save me editing a bunch of config files.

Don't wanna debate the why and wherefore. Just wanna keep it simple.

The time you have taken to reply is much appreciated, thank you.

This may be a barbaric template/config for you, but it is precisely what I want. Surely Virtualmin can do it.

<div class='quote'>turn those users into Webmin users, and you can then assign virtual servers in Virtualmin to them.</div>

Great. Yes please! The question was: how? I'm sure it's all very simple. I'm just not seeing the link, the field, the radio group, whatever it is.

I have created the webmin user. How to &quot;assign virtual servers&quot; ?

That will be half the battle. Many virtual servers, one owner, one webmaster, one gargantuan parent webroot, one staff, one stiff, just me.

The other half of the battle is modifying the subserver template so that I can create subdomains in my prehistoric unintuitive backward maladjusted dysfunctional (and apparently cPanel) style :) This too must be something very simple. Perhaps ${HOME}/public_html/${PREFIX}.

Or maybe I should just forget about me, and create a new user, and let Virtualmin do the whole tamale: sql, ftp, websites etc. Hey maybe I should get cPanel!!

<div class='quote'>you can run different PHP environments, have different mailboxes, have different SVN repos, have different configurations for pretty much any feature (but you don't have to).</div>

It's the &quot;you don't have to&quot; part I am interested in.
I want it all the same.
The only thing that changes (in tandem please) is the sub-folder name and the sub-server name.

Once again I appreciate your replies.
I am coming from years of &quot;managed hosting&quot; into my own box.
My own ignormace is appalling and I know that.

I have just today discovered my host created a symbolic link mapping &quot;/var/www&quot; to &quot;/home&quot;. It is these niggly little details that account for my confusion.

Sun, 06/07/2009 - 07:51
steward

Ya, talking past each other.

I have existing software which requires this particular web folder layout to handle subdomains and share code. The benefits to me are enormous.

I don't care about google or page ranks or SEO. NOINDEX,NOFOLLOW and get off my sites.

I have no users (webmasters, virtual staff, whatever). Only me here.

Don't know about cPanel. Heard about it. That's all. Virtualmin looked like a better solution.

I was just looking for a quicky tool to save me editing a bunch of config files.

Don't wanna debate the why and wherefore. Just wanna keep it simple.

The time you have taken to reply is much appreciated, thank you.

This may be a barbaric template/config for you, but it is precisely what I want. Surely Virtualmin can do it.

<div class='quote'>turn those users into Webmin users, and you can then assign virtual servers in Virtualmin to them.</div>

Great. Yes please! The question was: how? I'm sure it's all very simple. I'm just not seeing the link, the field, the radio group, whatever it is.

I have created the webmin user. How to &quot;assign virtual servers&quot; ?

That will be half the battle. Many virtual servers, one owner, one webmaster, one gargantuan parent webroot, one staff, one stiff, just me.

The other half of the battle is modifying the subserver template so that I can create subdomains in my prehistoric unintuitive backward maladjusted dysfunctional (and apparently cPanel) style :) This too must be something very simple. Perhaps ${HOME}/public_html/${PREFIX}.

Or maybe I should just forget about me, and create a new user, and let Virtualmin do the whole tamale: sql, ftp, websites etc. Hey maybe I should get cPanel!!

<div class='quote'>you can run different PHP environments, have different mailboxes, have different SVN repos, have different configurations for pretty much any feature (but you don't have to).</div>

It's the &quot;you don't have to&quot; part I am interested in.
I want it all the same.
The only thing that changes (in tandem please) is the sub-folder name and the sub-server name.

Once again I appreciate your replies.
I am coming from years of &quot;managed hosting&quot; into my own box.
My own ignormace is appalling and I know that.

I have just today discovered my host created a symbolic link mapping &quot;/var/www&quot; to &quot;/home&quot;. It is these niggly little details that account for my confusion.

Topic locked