Skip to main content

How to host subdomain on a different server than the main domain?

Comments

31 comments

  • cPRex Jurassic Moderator
    Hey there! As far as the internet portion of the traffic, you are correct - you just need the A record where your DNS is hosted to point to the correct system. However, you also need to have the correct entries setup on that webserver as well. For example, on a cPanel machine, you'd need to ensure the subdomain is created in cPanel or else Apache won't know where to serve the content from. Even though the DNS may be pointed properly, the webserver side still needs to exist so it knows how to handle that. Maybe that is what they were getting at?
    0
  • skrl
    Hey, thank you for your prompt input. So when the account for the subdomain is created, would that be all on the server side under regular configuration? By the way should there be any problem whatsoever creating the cPanel account, and associating it with the subdomain.mydomain.com as the primary domain? Does cPanel really care if that domain name already exists or not? Or does it care whether it is pointed to a different host or not? To my knowledge it does not, but I just want to double check because I am at a point where I am doubting everything I think I knew... The server hosts another installation as well. There's only one public IP, and zero dedicated ones. But I would not expect that to be a problem; when you purchase a shared hosting plan that is usually the case also, isn't it? How do you generally go about doing such implementations as the one I am trying to achieve here? (edit: What settings should I ask them if they have set them up correctly?)
    0
  • ffeingol
    It's easy and we do this all the time:
    • On Server-A create mydomin.tld ( your IIS server)
    • On Server-B create subdomain.mydomain.tld (the cPanel server)
    Then in your DNS you just need to create the "A" record to point subdoamin.mydomain.tld to the IP assigned in cPanel. cPanel is perfectly happy to create the account as a sub-domain.
    0
  • skrl
    It's easy and we do this all the time:
    • On Server-A create mydomin.tld ( your IIS server)
    • On Server-B create subdomain.mydomain.tld (the cPanel server)
    Then in your DNS you just need to create the "A" record to point subdoamin.mydomain.tld to the IP assigned in cPanel. cPanel is perfectly happy to create the account as a sub-domain.

    So I should not need a dedicated public IP just for every individual cPanel installation. I just need a cPanel account for every installation, with subdomain.mydomain.com as my primary domain associated with this one account in this case. Then the A record goes in my DNS, and the rest should be taken care of by the cPanel and/or Apache; have I got it down right? No special back-end handling on behalf of Host B? That is how I had everything in my mind to start with, but then my back-end support said it can't be done, or it wil not work, or it is not as easy and what not, and got me into doubts.
    0
  • cPRex Jurassic Moderator
    Yup - it really should be just that easy. It's a very common setup, and the fact that one box is cPanel and one isn't doesn't matter at all.
    0
  • skrl
    Alright, thank you all for your input.
    0
  • PeteS
    Will this also work if the subdomain is a set up as an addon domain? Like this: Server A hosts example.com Server B hosts domain.com Can I do this on server B? --> setup an addon domain in domain.com's account of subdomain.example.com Or will this yell at me because example.com is DNSed to another server? For DNS, A & B are in the same DNS cluster. Not sure if that helps or complicates, but you would need to make sure example.com's DNS zone points subdomain.example.com to the shared IP of domain.com's server, and if a DNS zone was also created for subdomain.example.com I would assume that could be deleted. Am I crazy? ;)
    0
  • PeteS
    I'm not crazy... it works fine. :) I had some time to test this and got it working pretty easily. I was testing on a non-clustered server, but I think it shouldn't matter. I did have to enable the proper nameserver IP for the test domain in Home / IP Functions / Configure Remote Service IPs. The only correction I would make is to the DNS comment... YES to making the example.com DNS zone point subdomain.example.com to the domain.com IP, but NO to deleting the DNS zone on domain.com's server created for subdomain.example.com.
    0
  • PeteS
    Almost a year later and I ACTUALLY need to do this, and it isn't working. I have example.com on server alpha.server.com. I need to create sub.example.com as an addon domain on server beta.server.com. The beta server hosts the domain server.com. Both servers are in the same DNS cluster. So the addon domain would be sub.example.com and the subdomain would be sub.example.com.server.com. I must do it as an addon rather than a new account because the beta server only has a one account cPanel license. I would think all I need to turn on is "Allow Remote Domains" in Tweak settings on the beta server (and I have). The error I get is "The domain "sub.example.com" may not be created by "server" because "example.com" is already owned by another user." This all seems logical that it's seeing that, but shouldn't "Allow Remote Domains" let it go through? (Both example.com and server.com are owned by root on their respective host servers.) I tried turning on "Allow users to park subdomains of the server"s hostname." and turning off "Check zone owner" in Tweak settings on the beta server but those made no difference. I also tried adding a Remote Name Server IP for the DNS cluster in Home / IP Functions / Configure Remote Service IPs on the beta server and that didn't help either. Is this not possible? What am I missing?
    0
  • ffeingol
    That error means exactly what it says. That sub-domain already exists on this server or (if the server is part of a DNS cluster) within the cluster and is owned by a different cPanel user. You'll need to look in DNS zones and/or the Apache config to see what other account has that sub-domain setup.
    0
  • xpy-xpy
    That error means exactly what it says. That sub-domain already exists on this server or (if the server is part of a DNS cluster) within the cluster and is owned by a different cPanel user.

    Not exactly. In this case the error says that it is example.com that exists on the server and is owned by another user, but not sub.example.com which PeteS is trying to setup. In my case the solution to a similar issue was to check "Allow cPanel users to create subdomains across accounts" in WHM/ Tweak Settings before attempting to setup sub.example.com in Cpanel.
    0
  • PeteS
    Not exactly. In this case the error says that it is example.com that exists on the server and is owned by another user, but not sub.example.com which PeteS is trying to setup. In my case the solution to a similar issue was to check "Allow cPanel users to create subdomains across accounts" in WHM/ Tweak Settings before attempting to setup sub.example.com in Cpanel.

    Correct, the subdomain doesn't exist, it's an ownership restriction. I had been looking for the "Allow cPanel users to create subdomains across accounts" setting and couldn't find it, and I *though* I had seen it mentioned in older posts, so I assumed it had been removed. NOW I see that it IS in 108, but not 106! The beta server is still on 106, so I think I have my solution! Thank you @xpy-xpy for causing me to look for it again. I'll assume that's the fix, and will report back if it doesn't.
    0
  • PeteS
    Ummm.... :rolleyes: Apparently the single account cPanel version omits "Allow cPanel users to create subdomains across accounts" and "Allow WHM users to create subdomains across accounts" from Tweak settings. So maybe those settings weren't just added in 108. I presume the thinking is "Who needs that if there's only one account?" Me! *raises hand* That ignores my scenario where the other user account is on another server! @cPRex can you give some insights? If it's as I presume, then that should be addressed asap. (In the mean time, is there a manual work-around?)
    0
  • cPRex Jurassic Moderator
    Let me do some testing and I'll let you know!
    0
  • cPRex Jurassic Moderator
    Can you check /var/cpanel/cpanel.config to see if "allowremotedomain" exists in that file on your server? If so, you can modify that to "1" over the command line to make that change without using the cPanel interface.
    0
  • PeteS
    Can you check /var/cpanel/cpanel.config to see if "allowremotedomain" exists in that file on your server? If so, you can modify that to "1" over the command line to make that change without using the cPanel interface.

    I see allowremotedomains=0 (plural) which I assume is it. I'll change to 1 and test, but will that persist or be overwritten. Once the addon has been created the setting is not relevant (to that addon), correct?
    0
  • cPRex Jurassic Moderator
    That setting will not get overwritten by anything, so it's fine to do that. Once the addon is created, you can change it back if you want to.
    0
  • PeteS
    Can you check /var/cpanel/cpanel.config to see if "allowremotedomain" exists in that file on your server? If so, you can modify that to "1" over the command line to make that change without using the cPanel interface.

    Not quite, but close enough to get me to the right place. The setting needed is: allowparkonothers=1 I set everything else to defaults again and that one setting change let it create the subdomain and DNS record. (Note, this was for doing it from within a cPanel account, as opposed to the setting: allowwhmparkonothers which won't allow cPanel accounts to do this.) Just a note for future readers, this isn't necessary to do manually unless it a single account license and thus "Allow cPanel users to create subdomains across accounts" and "Allow WHM users to create subdomains across accounts" is missing from Tweak settings. Thanks for the help @cPRex, and can this be put back in the single account license package? I feel this is a bug report, and not a feature request... ;)
    0
  • cPRex Jurassic Moderator
    It's definitely an issue, but I'm trying to understand the background of what led to this setting being necessary on a Solo account. Can you get me a summary of what led to this need just so I can make sure I'm reporting things correctly to the devs?
    0
  • PeteS
    It's definitely an issue, but I'm trying to understand the background of what led to this setting being necessary on a Solo account. Can you get me a summary of what led to this need just so I can make sure I'm reporting things correctly to the devs?

    Scenario: A company has two websites: main.com and unknown.com, in different data centers, and they are Solo licenses. They want a support portal for main.com that is available even if the main.com is not. They don't want to have to say "If main.com is down, report it at support.unknown.com." so this allows support.main.com will be available even if main.com is not. Does that make sense?
    0
  • cPRex Jurassic Moderator
    Okay, one last item. I did confirm that "Allow Remote Domains" is present on a Solo-licensed machine, but I'm not sure how the Allow cPanel users to create subdomains across accounts or Allow WHM users to create subdomains across accounts tools would be helpful in this situation, since you can only have one cPanel account. That tool isn't smart enough to detect a DNS cluster and deal with anything related to that.
    0
  • PeteS
    Okay, one last item. I did confirm that "Allow Remote Domains" is present on a Solo-licensed machine, but I'm not sure how the Allow cPanel users to create subdomains across accounts or Allow WHM users to create subdomains across accounts tools would be helpful in this situation, since you can only have one cPanel account. That tool isn't smart enough to detect a DNS cluster and deal with anything related to that.

    Correct, and you had me check for that in the file as well. It makes logical sense to me also that the remote domain setting would be the issue. But from the wording of it, it seems like "Allow cPanel users to create subdomains across accounts" would also apply. Interestingly, ONLY the latter applies, as xpy-xpy suggested:
    In my case the solution to a similar issue was to check "Allow cPanel users to create subdomains across accounts" in WHM/ Tweak Settings before attempting to setup sub.example.com in Cpanel.

    I would think based on the text names of each that BOTH would be required to be set on, but that's not what I experience. I tested again now, by attempting to set up an ADDON subdomain on a Solo account server, for a different domain/user on a non-Solo server. This fails: allowparkonothers=0 allowremotedomains=1 This works: allowparkonothers=1 allowremotedomains=0 No other settings were changed from default in Tweak setting - Domains. Seems like maybe the interactive logic between these for this functionality is not behaving as intended. Can you duplicate this behavior?
    0
  • cPRex Jurassic Moderator
    Just to confirm I'm doing this right, I need to create my one domain in Solo, then setup an addon domain that isn't pointed to the server, correct?
    0
  • PeteS
    Just to confirm I'm doing this right, I need to create my one domain in Solo, then setup an addon domain that isn't pointed to the server, correct?

    Yes, I think you are saying the same thing as I am. See below... I should add that both servers are in the same DNS cluster. Non-Solo server hosts example.com as normal. Solo server hosts domain.com as normal. Add an addon of sub.example.com in domain.com's account on the Solo server (it will set DNS to point to the Solo server's IP in the zone for example.com)
    0
  • cPRex Jurassic Moderator
    I did some testing on my end, and so far I haven't been able to reproduce this issue. Since you have an environment where this is happening could you create a ticket with our team so we can check it out?
    0
  • PeteS
    I did some testing on my end, and so far I haven't been able to reproduce this issue. Since you have an environment where this is happening could you create a ticket with our team so we can check it out?

    Ok, will report back.
    0
  • PeteS
    I did some testing on my end, and so far I haven't been able to reproduce this issue. Since you have an environment where this is happening could you create a ticket with our team so we can check it out?

    Wait... no ticket... instead, let's be clear on which server we are making the setting changes. I was making all these setting changes on the server creating the subdomain (the Solo server). But I re-read the description for allowremotedomains and it sounds like it allows OTHER servers to set up a subdomain for a domain it serves. "This setting allows the creation of parked domains (aliases) and addon domains that resolve to other servers." That's what I see in testing. If I set allowremotedomains=1 on the main domain's server it allows the other (Solo) to set up a subdomain for remote the main domain, and no setting changes on the Solo server are needed. Also if I reverse the scenario (setting up a subdomain on a multi account server, off a main domain on a Solo server) the necessary setting (allowremotedomains) IS available on the Solo server. So it seems that allowremotedomains works as expected, and does not take into account whether servers are in a cluster, in that it allows or prevents ANOTHER server from creating a subdomain for an account it hosts. BUT... consider how allowparkonothers works when I tested it on DNS clustered servers. You can set up a subdomain for a domain on a another server by setting allowparkonothers=1 on the server creating the subdomain, even though allowremotedomains=0 is set on the other (main domain's) server. Setting allowparkonothers=0 on either/both has no effect in preventing creation of subdomains between the two servers, if allowparkonothers=1 is set on the server creating the subdomain. (I tested this both directions and it holds true.) I tried this for a remote domain NOT in the DNS cluster, and that didn't work (as expected). Not sure if we should call this a bug or a feature. ;) I assume allowparkonothers was meant to allow this where the scenario is between accounts on the SAME server. "This setting allows a cPanel user to create an addon domain or subdomain on a domain that another user owns. For example, if a user owns the example.com domain, another user could create the store.example.com subdomain." Setting allowparkonothers=1 on the server creating the subdomain also allows it create subdomains on OTHER servers in the DNS cluster even though allowremotedomains=0 is set. I assume because they are not considered remote since they are clustered, and may have been by design. If so, then it would still make sense for allowparkonothers and allowwhmparkonothers to be available on a Solo server. It allows the operation to be completed from ONE server, and it's a lesser concern IMO than opening up allowremotedomains. This would be especially true if all the accounts in a cluster were controlled by the same company/person, and they might want to leave allowparkonothers enabled, but definitely wouldn't want leave allowremotedomains enabled since it would allow any server to create a subdomain for a domain it hosts. (Or is it only effective within a cluster? This I couldn't test.) If I am understanding this correctly, it seems allowremotedomains ignores DNS clustering, and allowparkonothers takes it into account, which seems a little odd.
    0
  • cPRex Jurassic Moderator
    I think we're giving these features too much credit and reading into things a bit at this point. allowremotedomains just checks, locally, to ensure the DNS points to the server you're creating the account on. It doesn't know about external servers or anything like that. The same is true with allowparkonothers - it's a local check.
    0
  • PeteS
    I think we're giving these features too much credit and reading into things a bit at this point. allowremotedomains just checks, locally, to ensure the DNS points to the server you're creating the account on. It doesn't know about external servers or anything like that. The same is true with allowparkonothers - it's a local check.

    Fair enough, but does locally mean only the server it is set on, or the DNS cluster? How is it that setting allowremotedomains=1 on another server (in the DNS cluster) allows me to create a subdomain off of the domain hosted on that other server (and has no effect if set on the server creating the subdomain)? Why does setting allowparkonothers=1 on the server creating a subdomain off of a domain hosted on another server (in the DNS cluster) allow that without allowremotedomains=1 being set? Without setting one of these settings as I detailed above, cPanel knows the base domain is on a different account than the account creating the subdomain. And the error is always about account/domain ownership, and never about it being remote, and this holds true for either setting in any combination. I can let this go, with the knowledge of what does and doesn't work in each setting's case, but I feel like either the docs need to way more detailed and clear, or things have changed with DNS clustering being added and the doc and/or functionality aren't quite up to date. Thanks for messing with this with me.
    0
  • cPRex Jurassic Moderator
    I honestly have no idea. I think we've reached the point of needing a ticket to do some more investigation though :D
    0

Please sign in to leave a comment.