I’m coding an application the lets people attach their custom domains to it without my manual intervention or messing with httpd.conf.
So I need a method very similar to the method described by Google at the following URL: How do I use a custom domain name on my blog? - Blogger Help… Except I’m not Google, so I may switch hosting provider anytime and the IPs will be completely changed.
That will cause a HUGE problem since it means I have to get everyone to update their domain CNAME settings which is impossible without severe downtime.
So how can I have the domains pointed to something fixed like ns1/ns2.mydomain.com?
No. CNAME domains point to other domains, not to IPs. So I can have in my DNS
mydomain.com IN CNAME yourdomain.com
So regardless if the IP of yourdomain.com changes, mydomain.com will still point to it. That’s the whole point of CNAME
From an Apache point of view, a CNAME is the same as a normal domain, so you can just add a new VirtualHost for the CNAME, or add a ServerAlias to existing VirtualHost and then run apache2ctl graceful to let Apache reload the configuration without actually rebooting.
From an Apache point of view, a CNAME is the same as a normal domain, so you can just add a new VirtualHost for the CNAME, or add a ServerAlias to existing VirtualHost and then run apache2ctl graceful to let Apache reload the configuration without actually rebooting.
Does that mean I have to add a new VirtualHost or ServerAlias for each new account I create from my application that has a custom domain or this is to be done only once?
Only have a single site on an IP address, then whenever Apache loads up that IP it’s always going to be your content regardless of the domain used - but that’s going to depend on your hosting company.
I should add that we have customers doing both methods that I mentioned - One using a ServerAlias setup with several hundred domains, the other uses a static IP for their site and goes with that method (basically the VirtualHost gets all traffic for that IP). Both work very well, the 1st is obviously more portable as it doesn’t rely on you having a dedicated IP.
Because google uses the CNAMEs for Mail servers (MX records), for which you can have multiple with different priorities for load balancing and other purposes. See MX record - Wikipedia, the free encyclopedia
AFAIK there is no such system for A records.