Hi @itechgrow,
It would be more of a server-side change rather than a DigitalOcean specific change. What you would need to do is the following:
- First point your new domain name A DNS records to your Droplet’s IP address. The change would need to be made under the active DNS zone for the domain name in question, for example if you are using DigitalOcean’s Nameservers then you would need to make that DNS change via your DigitalOcean Control Panel. Here’s a step by step guide on how to manage your DNS zone via DigitalOcean:
https://www.digitalocean.com/docs/networking/dns/how-to/manage-records/
- Once your Domain name is pointing to your Droplet, you would need to SSH to your Droplet and update your Virtual Host or Server Block from the old domain name to the new domain name, this would depend on what web server you are using. One way to find out what web server you are using is to first SSH to your Droplet and run the following command:
sudo netstat -plant | grep 80
On an Ubuntu Droplet, if you are using Nginx, you could find your Nginx server block at:
/etc/nginx/sites-enabled/your_domain_com.conf
For Apache this would be:
/etc/apache2/sites-enabled/your_domain_com.conf
Make the change and then restart your web server:
For Nginx:
systemctl restart nginx
For Apache:
systemctl restart apache2
Also if you are using a CMS like Wordpress you would need to update your Site and Home URLs to your new domain name, or if you are using a framework like Laravel, then you need to change your APP_URL
in your .env
file to the new domain
Finally, you could also rename your Droplet so that when you access your DigitalOcean control panel you could easily figure out what’s hosted on that Droplet. To do that you need to go to your DigitalOcean control panel at: https://cloud.digitalocean.com/ > then click on your Droplet > then click on the name of the Droplet and just edit the name
Hope that this helps!
Let me know if you have any other questions.
Regards,
Bobby