Multiple Domains and Subdomains on single directory

7 posts / 0 new
Last post
#1 Thu, 02/02/2012 - 06:06
effisk

Multiple Domains and Subdomains on single directory

Hi,

I'm a complete newbie with Virtualmin/Webmin, and dedicated servers in general.

Here is what I need to do:

PART 1/
I have several domain names:
www.domain.com
www.domain.fr
www.domain.co.uk

They must all point to the same location (same /prod-directory) and use the same prod-database. Content is served according to the domain name (if domain.com => serve content in US English, if domain.fr => serve content in French, etc.)

PART 2/
I also have development versions for these websites, with the same features:
dev.domain.com
dev.domain.co.uk
dev.domain.fr

They must all point to the same location (same /dev-directory) and use the same dev-database. Content is served according to the domain name (if dev.domain.com => serve content in US English, if dev.domain.fr => serve content in French, etc.)

And finally, I have a multi domain certificate (MDC) to secure all these subdomains (but that's for later).

I know how to create a top-level server and an alias (that seems to cover PART 1).

However when I want to create a sub-server (PART 2), I don't know how to make the new subdomain point to a different directory than the default directory.

So my question is: what do you recommend?

- Create a symbolic link to /dev-directory from the default directory
- Change the settings to make the sub-domain point to /dev-directory (and if so, how?)
- Other solution?

Thanks a lot for your help!

Francois

Thu, 02/02/2012 - 10:21
andreychek

Howdy,

I'm a complete newbie with Virtualmin/Webmin, and dedicated servers in general.

Excellent, welcome! That's how we all started!

I have several domain names They must all point to the same location (same /prod-directory) and use the same prod-database.

It sounds like you have the content portion of these sites already, and that you're just asking how to make a set of websites all point at the same directory.

So it sounds like just need a main domain, and then to setup a number of aliases.

To do that, go into Create Virtual Server, and setup one of your domains as the main Virtual Server (a "Virtual Server" is a fancy name for a domain).

Once you have one Virtual Server setup, go back into Create Virtual Server, and this time, click "Alias of domain.com".

You can create as many aliases as you'd like.

I know how to create a top-level server and an alias (that seems to cover PART 1).

Oops, I typed all the above out before reading that, but it sounds like you're already on the right track :-)

However when I want to create a sub-server (PART 2), I don't know how to make the new subdomain point to a different directory than the default directory.

Do you have an example of how you'd like this to work?

However, Virtualmin tries pretty hard to put any Sub-Servers into the directory $HOME/domains/SUB_SERVER_NAME.TLD.

While there's ways around that, it can sometimes be a little bit of a battle, so I'm hoping to understand what exactly you're trying to do there so that I can offer the best way to accomplish it.

-Eric

Fri, 02/03/2012 - 05:27
effisk

Do you have an example of how you'd like this to work?However, Virtualmin tries pretty hard to put any Sub-Servers into the directory $HOME/domains/SUB_SERVER_NAME.TLD.While there's ways around that, it can sometimes be a little bit of a battle, so I'm hoping to understand what exactly you're trying to do there so that I can offer the best way to accomplish it.
Thanks for your help Eric.

I have noticed that Virtualmin puts sub-servers into $HOME/domains/SUB_SERVER_NAME.TLD.
I have tried to change that path in several locations but no luck (Edit Directives, Document root directory...)

What I would love is something like:
All www subdomains (www.domain.com, www.domain.fr, etc.) point to $HOME/www
All dev subdomains (dev.domain.com, dev.domain.fr, etc.) point to $HOME/dev

That would be the cleanest way to do things i reckon. However if that's not possible I suppose I can still create sybolic links to $HOME/www and $HOME/dev from wherever Virtualmin puts the sub-servers.

Fri, 02/03/2012 - 06:35
effisk

OK I think I found the best/easiest solution:

I created two "Top-level servers":
domain.com
dev.domain.com
For each of these, I assigned a new "Website documents sub-directory":
/www for domain.com
and
/dev for dev.domain.com

And then, for each other TLD, I just created aliases of either dev.domain.com or domain.com, so for instance:
dev.domain.fr is an alias of dev.domain.com
domain.fr is an alias of domain.com

and voilĂ !

Fri, 02/03/2012 - 07:20
effisk

It's not so simple.

dev.domain.com and domain.com are now on two different vitual servers, but my directories are both in domain.com:

/home/domain.com/www and /home/domain.com/dev

The problem is that when I point dev.domain.com to /home/domain.com/dev I get an error: "Forbidden You don't have permission to access / on this server."

What should I change?

Thanks

Fri, 02/03/2012 - 07:51
effisk

Mmmh... I moved the dev.domain.com virtual server (with domain.com as a parent server) and it worked. However aliases for dev.domain.com did not work.

So I moved dev.domain.com again out and it all worked.

Very confusing.

Mon, 02/06/2012 - 02:51
effisk

Hi Eric,

I'm a bit lost here. I don't know how I got it to work last week, but I cannot reproduce it.

I don't know if I should set up my dev subdomain as a subserver or as a server.

The problem (is that a problem?) is that I want to point dev.domain.com to:
/home/domain.com/projectname/dev

The content of domain.com is at:
/home/domain.com/projectname/www

What do you recommend?

Thank you.

Topic locked