How to create a staging site from a live site with a let's encrypt ssl already installed?

Hi guys,

We’re trying to build a large wordpress woocommerce site ( a bookshop with 50k+ products) but we’re hitting a bit of a brick wall in terms of making a duplicate staging site in digital ocean on a separate droplet.

We are using a Lemp stack on Ubuntu 18.04 with a let’s encrypt ssl that renews automatically via cron.


  1. Take a snapshot of the live site
  2. Spin up a new droplet of the same specs using the snapshot we’ve just created
  3. Point our new staging domain name servers at the new droplet’s ip address

The problem we have is when we then try to navigate to our staging site we get 301 redirected to the live site urls each time. We can’t login to wp admin at all. I presume this is due to the ssl certificate having the live site’s details.

I’ve tried commenting out lines in /etc/nginx/sites-available that relate to the Let’s encrypt SSL certificate of the live site but that doesn’t do the trick.

Is it simply a case of finding and replacing all instances of the live domain name with the new staging domain name in the database and changing the domain names over on the ssl?

It would be great if there was a way of just removing the ssl from the staging site entirely via console, then just creating a new ssl that’s correct. Are there any places I should be looking in order to do this?

If there’s anyone who’s had experience of creating a staging site from a live site that already has an ssl on it, any help would be very much appreciated:) Unfortunately we have to do it this way.

Thank you in advance


Submit an 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.

I’m using Ubuntu 16.04 and had a similar problem, although I believe that it had nothing to do with the cert. When creating a droplet from a snapshot, the default .conf configuration file still points to the root domain, not the staging domain (doesn’t matter that DNS is setup properly). In my situation, I had to add a Step 4 to your Steps 1-3:

Step 4: i. my_computer$ ssh root@my_new_staging_ip_address ii. root@staging# cd /etc/apache2/sites-available iii. root@staging:/etc/apache2/sites-available# nano 000-default.conf iv. Re-write two lines in the “000-default.conf” file:


<VirtualHost *:80>
        Redirect permanent /


<VirtualHost *:80>
        Redirect permanent /

Save the 000-default.conf file (Control+o, Enter, Control+x)

v. root@staging:/etc/apache2/sites-available# systemctl restart apache2 vi. root@staging:/etc/apache2/sites-available# exit vii. my_computer$ sudo subl /etc/hosts viii. Add IP address and staging domain here:

xxx.0.0.x	localhost	broadcasthost
::1             localhost

ix. Cmd+s #to save the file x. Clear cache on your browser

Result: success… Now when typing either my_staging_IP_address (only need steps i-vii) into my browser OR, I’m successfully redirected to Note: I do have a safety warning from my browser because my particular cert does not cover subdomains…but I can ignore that.

Entire Step 4 explained: i. SSH into your domain (I did this as root)–there is decent documentation on setting up SSH in DO ii. Change directory to find the “000-default.conf” file #no need to separate these steps ii and iii, just writing this the long way iii. Open “000-default.conf” file with nano text editor iv. Change settings to point to your staging site:

  • Resource: using parts of “Step 4” from this tutorial on DO v. From “Step 5” in that tutorial above, simply restart the apache2 server for changes to take effect vi. exit back to local machine terminal for final steps vii. open /etc/hosts with my text editor, which is Sublime in my case (from “Step 6” in that tutorial) viii. Add my IP address and staging domain just above the final line ix. save with Sublime or whatever text editor x. I needed to clear my cache, since previous attempts all redirected to

This comment has been deleted


I have a very similar situation, except that my staging site (using staging subdomain DNS) is a new droplet from scratch, as opposed to a snapshot from existing droplet.

When I set up the Let’s Encrypt SSL via Load Balancer, the traffic to my new site is certified but the certificate on the original/old site (master domain) is no longer active. Visitors get a page saying traffic is not secured.

It seems the certificate is interfering across the entire domain although I configure it for the subdomain only.