This is the part I’m currently at: https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04#step-5-setting-up-server-blocks-recommended
Thing is, it’s really confusing to set up the correct DNS, since it takes 24 hours to check if they’re right.
What I want is to have a server block that is connected with a subdomain in Namecheap. In my Networking panel in DO I set up a domain website.com
and the DNS entry is Type A
, hostname sub.website.com
and value 165.69.24.420
Now in Namecheap the same: A Record
, sub.website.com
and value 165.69.24.420
.
Am I missing something? When I whip up the website it says DNS_PROBE_FINISHED_NXDOMAIN
, even after 24 hours. I saw that I had to put in
- ns1.digitalocean.com
- ns2.digitalocean.com
- ns3.digitalocean.com
Into Namecheap, but that would be for the root domain, right? It does confus me alot and I hope to find a solution. The root domain for website.com points to another server.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hey!
To correctly set up a subdomain with DNS entries in Namecheap and point it to a server managed by DigitalOcean, you need to understand the roles of different DNS records and where they should be configured. Since your root domain (
website.com
) is hosted elsewhere and you want only the subdomain (sub.website.com
) to point to the DigitalOcean server, you’ll need to set up specific DNS records carefully.Since you’re not moving your main domain to DigitalOcean, you don’t need to change your domain’s nameservers to DigitalOcean’s (
ns1.digitalocean.com
,ns2.digitalocean.com
,ns3.digitalocean.com
). You only need to create a DNS record for the subdomain within DigitalOcean’s networking panel:sub.website.com
(or justsub
if DigitalOcean autofills the domain part)165.69.24.420
(your server’s IP address)In your Namecheap DNS settings for
website.com
, you need to add a record that pointssub.website.com
to your DigitalOcean server:sub
(just the subdomain part, without the main domain)165.69.24.420
(your DigitalOcean server’s IP address)This setup tells the DNS system that when someone requests
sub.website.com
, they should be directed to your DigitalOcean server.DNS changes can take some time to propagate, typically up to 24 hours, but often it’s much quicker. You can check the status of your DNS propagation using tools like
https://www.whatsmydns.net/
.If, after the propagation period,
sub.website.com
still isn’t resolving to your server, double-check the following:sub
).Make sure your server is configured to respond to requests for
sub.website.com
. If you’re using Nginx, this involves setting up a server block forsub.website.com
. If you’re using another web server, the configuration would be similar in context.Let me know how it goes!
Best,
Bobby
Heya @eriksachse,
So, the Nameservers show from where your DNS is being controlled by however the subdomain DNS would be controlled by where your root domain’s DNS is.
Basically, there is no need to create your subdomain in DigitalOcean as a domain. What you need to do is add an A record for your subdomain where
website.com
’s DNS is being controlled by. If it’s Namecheap, then that is the place where you should add the DNS for your subdomain.