I am offering to my costumers a web based app hosted on dedicated servers, so clients can register on the website and use the service by using the URL : mywebsite.com/client.

The service is running and I have no problem with it !

Actually, I would like to add a new option to the app and let costumers use their own domain, BUT have the app still hosted on my servers !

Now I would like to know how I can add new domains to my server (I know they should be pointed to my name servers) automatically and by using PHP scripts ?

So clients add the domain, they get NS URL's and IP's and after they changed the domain name servers, they can use the service using their domain name

I'm pretty sure I need to edit Apache config file for that, but I have no idea, what modification should be done !

In general, I would like all clients domains will be added as an addon domain to my domain where the app is hosted ! So I can get the domain name as user identifier !

*I use Centos and also centos web panel


There will be a myriad of solution architectures enabling you to do this, I will outline two of them, which are at the non-technical and technical end of the spectrum.

What you are looking for here could be called hosting company software or similar, but you need a system that has an API to integrate with your software system.

At the non-technical end I've heard people using https://www.whmcs.com/, which I know has integration for common CMS, billing, web server and database server. To manage your own domain setup, you will need it to also manage a DNS server or use one that has an API. For example, you could use Amazon Route53 for that or let WHMCS manage your own DNS server, for example BIND.

At the technical end, I'm managing web server setups including domain names with Ansible and I intend to integrate this with a custom developed PHP based control panel. Ansible as well as PHP directly can certainly use the Amazon Route 53 API, so this would allow for full automation as well.

Either way, based on how you phrase your question there are a lot of architecture pieces to put together and implementations tested. Good luck

  • Actually i found a solution but i'm not sure if it will work as I want or not ! I don't tested it yet, but the solution is to put a wildcard virtual host in the apache virtual host configuration file and if a domain is pointed to the server, they will automatically show the default page and I can manage and check domains and users from there ! As I said, I just read it but I didn't test it yet ! And I prefer to not use any 3d party API or script for that ! between, the panel I use to manage the servers is written in PHP.
    – Sinf
    Jan 30 '17 at 7:23

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