Launching Web Service

I’m going to be launching a new web application within the next few weeks (hopefully), and the server side is a bit more complicated than what I’m used to.

I’m currently on a CentOS VPS, which runs on cPanel. Each client in this application will use their own domain name. I’m using PHP’s $_SERVER[‘SERVER_NAME’] to determine which site the application is being requested on.

Anyway, this is mostly fine and dandy when testing locally. It’s very easy to add virtual hosts manually. So, when moving this into the cPanel environment, I have a few questions:

  1. How can I have it point all domains not already created as accounts, to a catch-all address? How do I set up the DNS for this?

  2. If one of the customers would like email and etc. set up for them, how do I handle that? Do I need to end up creating an account in WHM for them and then set up their email. Can I do that at the DNS level only? If it’s the former, how can I easily point their web stuff to the catch-all account so I don’t have to mess with file permissions and other account differences? My host briefly mentioned add-on domains, but I’d really like to keep this entirely automated/transparent if at all possible.

If anyone has any general feedback for this type of application their advice would also be appreciated.

Thanks!

You can also use $_SERVER[‘HTTP_HOST’]

  1. To do this, you need to set up wildcard DNS. I think you can add a subdomain with the name * to do this. Although I don’t remember exactly. Just google “cpanel wildcard dns”
  2. If a customer needs an email, you can very easily add it from the CPanel of whatever domain they need the email for. If you want to do it from your own app, check out the cpanel api, it’s very easy to use.