Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am setting up a hosted web service; it doesn't matter for the sake of this question exactly what the service is. A feature which I hope to add shortly will allow users to point their own domain to it, so that they use their domain to access their branded "website" on my service.

So by default they get a subdomain like example.mydomain.com, but they should have the option of pointing a domain such as example.com to my servers so that they can use that name instead.

Ideally, they should be able to create a CNAME record pointing to my domain, and notify my system of their domain, and it should "just work".

However, at the moment I have to manually add each domain as a "parked domain" in my CPanel before the domain will resolve to my site correctly.

At the moment I am using shared hosting. Once I have a few customers I will be moving to a dedicated server. My service is built using PHP (based on WordPress, in fact, though with heavy modifications and customisations).

So I have two questions :

  1. Is there a way that can I make my system "automatically" handle new domains pointed to it, without having to manually add each one via CPanel? (For example, is there a way for PHP to interact with CPanel to do this automatically?)

  2. Presumably once I have mved to a dedicated server this will be easier since I will have control over the whole system. What will then be the best way to achieve the same result?

Thanks.

share

migration rejected from stackoverflow.com Jul 2 '13 at 3:11

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by Falcon Momot, Michael Hampton Jul 2 '13 at 3:11

  • This question does not appear to be about professional server, networking, or related infrastructure administration within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
This question appears to be off-topic because it concerns the use of shared web hosting by end users or resellers, rather than the administration of web hosting. –  Falcon Momot Jul 1 '13 at 6:22

2 Answers 2

Websites have 3 bindings to be concerned about. The IP, Port and Host Header. In your case it's the Host Header that you're most concerned about. The Host Header is the domain name. Your host probably assigns specific host headers to your site and when you add a new domain in cPanel, it adds the new host header to your website binding.

What you want is a dedicated IP and to leave the host header blank. Then it will catch all domains pointing to an IP address. Have your users point their DNS record to your IP address and the web server will listen and respond to that. Your host may or may not offer dedicated IP address, but when you move to your own solution, you can definitely do it then.

Once the request arrives and is bound to your web site, then you have full access from WordPress to run with it from there.

share

If you'd move to a dedicated server you're looking at modifying your vhosts.

For now I don't think there's an easy way to automatically modify your vhosts on the shared hosting. To modify them you'll need to restart apache, wich in a hosted enviroment can't be recommended.

share

Not the answer you're looking for? Browse other questions tagged or ask your own question.