In this article I will be adding a domain name to my digital ocean droplet. I have just deployed my fullstack react node project to digital ocean. This is a Production ready MERN (MongoDB Express React Node) Stack App with Ultimate Authentication. This app includes Email Activation, Forgot/Reset password, Login with Facebook and Google, Admin Auth Routing, ACL (access control) and profile update feature. The entire process is covered in a video course and it live on Udemy Check it out if interested!
Adding a domain name to your digital ocean droplet
We have deployed out app to digital ocean but there is a bit more to do if you want to use it in real world. And that is adding a domain name.
Why I choose to write articles and not videos
You don't have to pause play repeat hundred times (there will be lot of steps, some will take hours of wait)
Written steps with screenshots are very easy to follow
For every project you have to go through the same steps so written steps will become a good reference
What else ... I am sure there are plenty of benefits but lets not worry about it and start the process of adding domain...
Buy your favourite domain name from namecheap/godaddy
I just bought a domain mern-stack.com from namecheap.
I recommend namecheap because their annual price is cheaper (godaddy is cheap/free? only first year).
They have very good live chat support 2/47.
Easy to use dashboard. I will be using namecheap for this project.
Login to your namecheap dashboard, there you will see your domain name.
Login to digital ocean
In your dashboard on top right click on green button that says Create
Choose option Domains/DNS from the dropdown list
Add a domain
Once clicked, that will take you to Networking page
Just below the title Networking, you will see a sub title that says Add a domain
You can enter your domain name there and click the button Add Domain
Now you will see a page where your domain name is on top with sub title that says Create new record
Create new record
The first option A is choosen by default
Type HOSTNAME @ , pick WILL REDIRECT TO choose from dropdown your droplet name (MERN-AUTH) with IP
Click create Record
Now you see one A record is added in DNS records. Not only A record, you will also see three NS records there
with the text something like ns1.digitalocean.com ns2.digitalocean.com ns3.digitalocean.com
Copy those NS (nameservers) record. and go back to your namecheap dashboard
Adding nameservers to your domain
In namecheap dashboard, Click on the Manage button on the right side of your domain name
Now on Nameservers option you will see Namecheap Basic DNS by default
Adding custom DNS records
Click on that and pick Custom DNS
Add those 3 NS records that you copied from digital ocean ns1.digitalocean.com ns2.digitalocean.com ns3.digitalocean.com
Once done click green tick icon to save
Digital ocean droplet is now associated with a domain name
Believe it or not, we are done!
Visit your site now. i will visit mern-stack.com
This project is a Production ready MERN (MongoDB Express React Node) Stack App with Ultimate Authentication. This app includes Email Activation, Forgot/Reset password, Login with Facebook and Google, Admin Auth Routing, ACL (access control) and profile update feature. The entire process is covered in a video course and it live on Udemy Check it out if interested!
This course has more topics covered than you would think. Here are some of the new lectures added to this course:
- Adding a domain name
- Cloudflare CDN and Free SSL
- Force HTTP to HTTPS
- Redirect all www to non-www
- Updating Google and Facebook login redirect to production domain
- Redirect Digital Ocean IP to actual domain name
If you come across any issues. Please leave your comments bleow. Cheers!