How to correctly set up DNS with custom name servers and IIS for multiple domains
I just obtained a Windows Server 2008 VPS. Rightly or wrongly I followed instructions from the host to set up custom name servers. So now I have ns1.mydomain.com and ns2.mydomain.com. The are both the same since I have 1 IP address. I have A records for www, * and a few others, no MX since I use Google Apps. I pointed my registrar that has mydomain.com to ns1.mydomain.com. All is well that works.
The problem is myOtherDomain.com. I set it's DNS on the registrar to point to ns1.mydomain.com and in IIS give it, it's own website and configure bindings with host name of myOtherDomain.com and www.myOtherDomain.com. I thought that was all I'd have to do. Apparently not. Do I have to add something else to the DNS Server? Should I have another custom name server? Since they are pointing to the same IP I figured IIS would untangle things with the host headers.
The site is php, not sure that is the problem though.
Solution 1:
Does your "ns1.myDomain.com" DNS server have a forward lookup zone configured for the "myOtherDomain.com"? Does that zone have the right records in it to resolve the "naked" domain name and the "www" hostname to the IP address of your web server computer?
IIS can handle the host headers fine, but all of the names associated with sites hosted by the machine will need to resolve to the IP address of the web server computer, too.
Solution 2:
First, if you only have one server you should only have one glue record. Do not create ns1 and ns2 that both point to the same IP. This causes headaches when your server is offline and gains you nothing.
If your registrar insists on you having two name servers get a free backup DNS service. I use afraid.org and buddyns.com; there are others around too. They're simple and free...
Also, at least one of your glue records for each domain should match the tld of the domain. So if you have example.org, at least one of the glue records (name servers with IP specified at the registrar) should also be ns1.whatever.org. You can have multiple, but at least one should match like this.
Make sure your DNS server (the one on your VM) is configured to server all your domains. If you have example.com and example.org, you'll need to configure both on the server. Be sure that each domain is setup with the relevant default record and any host records you want (like 'www' or 'ftp'). Make sure the SOA and NS records are configured correctly (SOA should be your VM ns1.example.com
; the NS records should be your VM and whatever backup DNS services you have configured, they'll come with more directions for setting up these records, it's just as easy as entering their server's names though).
In IIS make sure you either have
- NO Host Headers configured (if you want all domains pointing to that server to get the same website)
OR
-
You have a Host Header configured for each domain name:
You can put all the Host Headers on the same IIS site (so they all get the same website);
OR
You can put each Host Header on different IIS sites (so they all get different websites).