jeudi 25 février 2021

How to set up domain hosting one server whilst having a subdomain hosted on another

So I bought a domain at NameCheap (supposed its called mydomain.me), and I want to use this domain to host my website on netlify.

The normal way to do this is by setting 4 custom DNS servers to
dns1.p02.nsone.net
dns2.p02.nsone.net
dns3.p02.nsone.net
dns4.p02.nsone.net

This method does work, however I also want to host a subdomain on a DIFFERENT DigitalOcean droplet at api.mydomain.me

I wasn't sure what to do so I added digitalocean's three nameservers to it as well:
ns1.digitalocean.com
ns2.digitalocean.com
ns3.digitalocean.com

(Suppose my DigitalOcean droplet's IP is 12.345.67.890)
On DigitalOcean, I have the following DNS records:
A Record: Hostname api.mydomain.me directs to 12.345.67.890
A Record: Hostname traefik.api.mydomain.me directs to 12.345.67.890
NS Record: Hostname mydomain.me directs to ns1.digitalocean.com
NS Record: Hostname mydomain.me directs to ns2.digitalocean.com
NS Record: Hostname mydomain.me directs to ns3.digitalocean.com

This configuration works.. kind of

Occasionally my netlify website at mydomain.me would go down, but spamming the refresh button would bring it back.
My API at api.mydomain.me would go down a LOT, and when it does come back it only works on desktop for some reason... then a little later it will work on mobile devices. Then it goes back down and repeats this process.



I feel like this kind of configuration I'm using is somehow interfering with each other. I kind of suck with this DNS record stuff. If someone could please let me know how to do this correctly, it would help a lot!




Aucun commentaire:

Enregistrer un commentaire