Question

Switch WordPress website on droplet secured with Let's Encrypt on a domain to production domain and re-secure it with Let's Encrypt

I’m new to Digital Ocean. I set up a WordPress website on a droplet, attached it to a subdomain and secured it with let’s encrypt. I was impressed with the speed of the server compared to my current host, so I have re-built(and improved) my small business website in that new WordPress installation. I want to change my business domain so that it is pointing to the droplet IP address and encrypt it using let’s encrypt. The domain I want to use (and do own) is pointing to my old website at a hosing company. I can’t figure out quite how to do make this change. When I open the terminal using access, it seems to want to install a new instance of WordPress and I don’t want to risk overwriting the website. Suggestions?


Submit an answer


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!

Sign In or Sign Up to Answer

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.

KFSys
Site Moderator
Site Moderator badge
June 16, 2023

Heya @andreagrebenc,

Basically, you want to point your actual domain to your new DigitalOcean Droplet and make it show the rebuilt website you built on your subdomain, is that correct?

If, yes, your situation involves several steps, and they can all be done without any risk to your current website setup.

  1. Changing the Domain Name System (DNS) records: You’ll first want to modify the DNS records of your business domain to point to the IP address of your droplet on Digital Ocean. To do this, you’d have to log into the platform where you purchased your domain (e.g., GoDaddy, NameCheap, etc.), then navigate to the DNS settings for your domain. You’d need to change the ‘A’ record to point to your Digital Ocean droplet’s IP address. Remember, DNS changes can take up to 48 hours to fully propagate across the internet.

  2. Set Up your new domain on the droplet: After that, you will need to set up your new domain on your droplet. If you used a LAMP stack to install WordPress, this would involve setting up a new virtual host file for your domain. This can be done by duplicating the existing configuration file for your current website, and just changing the domain name and directory location.

  3. Configure WordPress to use the new domain: The next step is to update the WordPress site URL and home URL to reflect the new domain. You can do this by logging into your WordPress dashboard, going to ‘Settings’, and then ‘General’. Enter your new domain in the ‘WordPress Address (URL)’ and ‘Site Address (URL)’ fields. Make sure to include ‘https://’ before your domain name.

  4. Setting Up Let’s Encrypt: The last step is to set up Let’s Encrypt SSL for your new domain. You can do this using Certbot, a free, open-source tool provided by the EFF. If you’ve already installed Certbot for your subdomain, you’d just need to run it again with your new domain.

Here’s a basic Certbot command that you could use, replacing yourdomain.com and www.yourdomain.com with your new domain name:

  1. sudo certbot --apache -d yourdomain.com -d www.yourdomain.com

After running this command, Certbot will guide you through the process of obtaining and installing a new SSL certificate. Make sure to choose the option to redirect all traffic to HTTPS when asked.

Note: Certbot commands could differ slightly based on the OS and web server in your droplet. I used Apache in the above example as it is one of the most common web servers used with WordPress.

Remember to test your website thoroughly after implementing these changes to ensure everything is working as expected. If you run into any issues or have questions about specific steps, feel free to ask!

Lastly, remember to take backups before making these changes. You can use Snapshots for that :

https://docs.digitalocean.com/products/images/snapshots/

Snapshots are on-demand disk images of DigitalOcean Droplets and volumes saved to your account. Use them to create new Droplets and volumes with the same contents.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel