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.
Process:
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
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.
Click below to sign up and get $100 of credit to try our products over 60 days!
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:From:
To:
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: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 ORstaging.my_domain.com
, I’m successfully redirected to staging.my_domain.com. 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:
This comment has been deleted
Hi,
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.