Install SSL on an existing wordpress

My website initially run without domain (only droplet IP), that’s why i skipped the SSL installation part in the very beginning configuration. I have domain for my site now and want to install the Let’s Encrypt to my site. Any instruction that can help on this? Many thanks.

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.

Bobby Iliev
Site Moderator
Site Moderator badge
December 11, 2023
Accepted Answer

Hi there,

This would require a few steps. And before making any changes, it’s crucial to back up your entire WordPress site (including databases and files). You can take a manual backup of your files and database or backup your Droplet directly.

Once you have your backup you can follow these steps:

  1. Update Apache Virtual Host

    • Edit the Apache configuration file for your website. This file is usually located in /etc/apache2/sites-available/. The file name would typically match your domain name or if it is the default one it could be called default or wordpress.
    • Make sure the ServerName directive is set to your domain, and add a ServerAlias for the www version of your domain. It should look something like this:
      <VirtualHost *:80>
         # ... other settings ...
    • Save the file and exit the editor.
    • Apply the changes by restarting Apache:
      sudo systemctl restart apache2
  2. Install Certbot and Obtain SSL Certificate

    • Install Certbot and the Apache plugin, if you’ve used the 1-Click WordPress installation, this should already be available:
      sudo apt update
      sudo apt install certbot python3-certbot-apache
    • Next, pbtain and install the SSL certificate:
      sudo certbot --apache
    • Follow the on-screen instructions. Certbot will automatically update your Apache configuration to use the SSL certificate.
    • Note that your domain name need have its A record pointing to the server IP address otherwise Let’s Encrypt will not be able to issue the certificate.
  3. Update WordPress URLs

    • Log into your WordPress admin dashboard.
    • Go to Settings > General.
    • Change the WordPress Address (URL) and Site Address (URL) from http:// to https://.
    • Save the changes.
    • If the site and home URLs are not present in there, or if you can’t access your wp-admin area, you would need to access your database with a tool like PHPmyAdmin or any other MySQL client, and update the velues of the site and home URLs in your wp_options table.

That would be pretty much it, next, you can test Your SSL Certificate, by visiting your website with https:// to confirm that SSL is working correctly.

A few things that you need to keep in mind:

  • Always backup your website before making significant changes, especially when editing configuration files or database settings.
  • The Certbot command will automatically renew your SSL certificate before it expires. However, it’s good practice to verify the auto-renewal process periodically.
  • After switching to HTTPS, monitor your website for mixed content issues where some resources might still load over HTTP. You can use browser developer tools or online services to check for such issues. In some cases, you might have to run a search and replace for your database and update all of the references for http://your_ip_address with

Hope that this helps!



Site Moderator
Site Moderator badge
December 13, 2023

Heya @quangrmit,

Here are the general steps you need to follow:

  1. Update Your Server: Ensure your server is updated. For a Linux server, you can typically do this with commands like sudo apt update and sudo apt upgrade.

  2. Install Certbot: Certbot is the software that will obtain a free SSL certificate from Let’s Encrypt and automatically enable HTTPS on your website. You can install it with a command like sudo apt install certbot.

  3. Choose Web Server and System: Certbot needs to know the web server you are using (e.g., Apache, Nginx) and your operating system (e.g., Ubuntu, Debian).

  4. Run Certbot: Execute Certbot with a command like sudo certbot --apache or sudo certbot --nginx, depending on your web server. Certbot will guide you through the process.

  5. Domain Verification: Certbot will ask for the domain names you want to activate HTTPS for. It will also handle the verification of your domain to ensure you own it.

  6. Configure Automatic Renewal: Let’s Encrypt certificates are valid for 90 days. It’s recommended to set up automatic renewal. This can usually be done by editing the crontab file with sudo crontab -e and adding a line like 0 12 * * * /usr/bin/certbot renew --quiet.

Make sure to do a backup of your Droplet prior to doing that. You can use the Snapshost feature for that:

Try DigitalOcean for free

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

Sign up

Featured on Community

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