Need to create cPanel Style subdomain : A subdomain pointing to a folder under main domain, with the SAME ip

13 posts / 0 new
Last post
#1 Fri, 11/23/2012 - 01:53
unity100

Need to create cPanel Style subdomain : A subdomain pointing to a folder under main domain, with the SAME ip

Hi people.

I have read various threads regarding this, none of that availed for my situation. What i need to do is :

Create subdomains for a domain, pointing to a folder under the main domain's document root, And that subdomain needs to have the external/internal ip shared with the parent domain. (A single ip assigned to that parent domain at this point).

There are various solutions i found in this forum, but all of the solutions provide for either half of what i need - the ones who provide the first part doesnt allow the ip to be shared with main domain, and the ones which do, require me to create the the subdomain as a sub-server.

I have read enough rhetoric against subdomains and whatnot in the threads i have examined, so therefore i dont think i need any more. If you would want to know a reason - i will create many subdomains, and i dont want separate usernames/passwords, various administration necessities popping up for each of the subdomains, or want to mess with managing many separate or shared ips and the ssl certificates. As it stands now, this is what i need : cpanel style subdomain pointing to a folder under the main domain with the same ip as the main domain, sharing the same ssl cert specific to that domain.

If someone can help me with setting this up with pointers, i will be glad. Thanks !

Sat, 11/24/2012 - 04:12
Locutus

I haven't tried this scenario myself yet, but it is possible that Virtualmin simply does not support what you're trying to do in an automatic way. The Vmin team shall please correct me if I'm wrong here.

If you MUST have Vmin servers, which are NOT sub-servers but MUST point to sub-directories, you'll probably have to configure those manually.

I.e. create alias domains to have them get a DNS zone that shares the IP, and the users and whatnot, and then manually add Apache virtual servers to point those to subdirectories. It's not pretty - but if you want to use Virtualmin in this scenario, you'll need to do that.

For more hints, we'd need to know more why exactly you're shunning sub-servers here, and if it's required that the browser keep showing the subdomain as opposed to a subdirectory.

Sun, 11/25/2012 - 20:15
tpnsolutions
tpnsolutions's picture

Hi,

The best way to accomplish this task, if simply pointing traffic from:

domain2.com => domain1.com/directory

would be through the use of "Proxy".

Setup "domain1.com" normally, upload your content the the sub-directory.

Setup "domain2.com" normally, then go into Virtualmin under:

"Virtualmin" > "Server Configuration" > "Edit Proxy Website"

This screen will let you point "domain2.com" to your sub-directory.

*** note: Virtualmin does support another method, however it'll likely be removed later and was basically created for backward compatibility and is not encouraged. therefore i won't waste time publishing these alternate instructions as they are not recommended. ***

-Peter

Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Tue, 11/27/2012 - 10:30
unity100

Wont there be any issues with any kind of scripts/software working on that proxied website folder, or, any issues with domain names, redirections, ip addresses as they appear to outside ? Or even maybe internally ?

Tue, 11/27/2012 - 13:54
Locutus

I guess you'll notice that when you try it out. :) It highly depends on the software in question.

For further insight, we'd need to know WHY you need to do that kind of redirection without changing the browser address bar.

Thu, 11/29/2012 - 07:14
unity100

i dont need to do a particular redirection. all i need is cpanel style subdomains.

Sun, 12/02/2012 - 16:01
unity100

I have done in a very ironic way - since the domain was going to be just moved to this server, i have moved it to a cpanel server first, created the subdomains i wanted, and then migrated the backup file i got from cpanel server to virtualmin.

and, in another incident ; on another already created virtual server which fortunately had had such cpanel subdomains imported while migrating to virtualmin, i have cloned the cpanel style subdomain from virtualmin control panel, and went down to httpd.conf to manually edit document roots and other necessary stuff to get the subdomain result i wanted.

this state of matters is most irritating and unproductive. cpanel type subdomains are being used web-wide. the fact that they cannot be easily done in virtualmin is pointless. unnecessary coder elitism doesnt serve anyone.

Mon, 12/03/2012 - 03:05
Locutus

I already told you that you can edit the Apache vhost manually to achieve your goal.

Nobody forces you to use Virtualmin. Why not stay with cPanel if you need its features so? Unnecessary slander doesn't serve anyone.

The other way round: why doesn't cPanel support Virtualmin style sub-servers? Coder elitism maybe?

Mon, 12/03/2012 - 06:32
Locutus

Also, there IS a switch in Virtualmin's config to turn on sub-domains. I don't know what exactly it does though, I never needed it. Using sub-servers is not coder elitism, but software philosophy, and their good right to declare discouraged what they don't consider to match their philosophy.

Mon, 12/03/2012 - 10:40
unity100

"Nobody forces you to use Virtualmin. Why not stay with cPanel if you need its features so? Unnecessary slander doesn't serve anyone."

Thankfully nobody is forcing me to. And it seems at this rate, i am going to evade using virtualmin in future projects, and very probably migrate away what i have out of it.

"The other way round: why doesn't cPanel support Virtualmin style sub-servers? Coder elitism maybe?"

cpanel was there before virtualmin. virtualmin is coming up as the alternative, and has the advantage of incorporating what others have done before - including cpanel. refusing to do it so on intellectual grounds is what is coder elitism. in retrospect, if virtualmin becomes as widely used, it is definite that cpanel will incorporate virtualmin styles to bolster their business.

.......

the thing is that, actually the fact that i have to EXPLAIN why there should be a feature that many people on the internet use and seek, is the thing that defines coder elitism.

in any case i consider this resolved to my dissatisfaction regarding virtualmin. ill take that into account when advising my clients from this point on. i appreciate and thank for the efforts community members spared for my issue. have a nice day.

Tue, 02/26/2013 - 17:18
unity100

I have found a solution by myself from other sources :

http://www.trickylinux.net/add-domain-virtualminwebmin/

"........ Steps To Create Sub-Domain:

Click on the Webmin from the right top. Click on the servers option at right side bar and select Apache Webserver. In right panel, click on “create new virtual host” In Handle connections to address select specific address and IP address you want to associate with sub domain in text field. In Document Root enter the path of sub-domain like “/home/username/public_html/foldername” Click on Create Now button. You are done with creating sub domain, next steps is to create A record for this sub domain. To create A record please follow the following steps:

Again click on Servers option in Webmin and select BIND DNS Server. Now select the zone of parent domain and click on “Add Record To Selected” button. A new window appears in right panel. In Record type to add select Address from drop down, in my case it selected by default. In new Record Name field, enter your subdomain name. In new record field, enters the IP address Now click on Add Record button at bottom. Your sub domain is ready to access now, try accessing it in browser if you are unable to access it please wait for DNS records to update. .........."

Mon, 08/12/2013 - 08:06
kill3r97

Steps To Create Sub-Domain:

Click on the Webmin from the right top. Click on the servers option at right side bar and select Apache Webserver. In right panel, click on “create new virtual host” In Handle connections to address select specific address and IP address you want to associate with sub domain in text field. In Document Root enter the path of sub-domain like “/home/username/public_html/foldername” Click on Create Now button. You are done with creating sub domain, next steps is to create A record for this sub domain. To create A record please follow the following steps: Again click on Servers option in Webmin and select BIND DNS Server. Now select the zone of parent domain and click on “Add Record To Selected” button. A new window appears in right panel. In Record type to add select Address from drop down, in my case it selected by default. In new Record Name field, enter your subdomain name. In new record field, enters the IP address Now click on Add Record button at bottom.

i dont know why you guys just post a way to do it instead of talking garbage

Mon, 08/12/2013 - 09:04
Locutus

Of course it works the "manual" way. Make sure to not use Virtualmin though for the domain where you do this manual stuff, cause you'll seriously confuse it with such manual intervention. :)

Topic locked