Moving certificate from apache server to an nginx server

I have two servers, one of which is maps1.cachly.com and is running Apache. I am needing to move the cert to a different server that is running Nginx and is currently using maps.cachly.com.

My goal is to retire the old maps1.cachly.com server and have maps1.cachly.com running on the new Nginx server.

On the Nginx server I ran this command:

sudo certbot --expand -d maps1.cachly.com

It produced this output:

Requesting a certificate for maps1.cachly.com

Certbot failed to authenticate some domains (authenticator: nginx). The Certificate Authority reported these problems:
  Domain: maps1.cachly.com
  Type:   unauthorized
  Detail: 45.79.108.51: Invalid response from https://maps1.cachly.com/.well-known/acme-challenge/10JcEo---(not sure I should include this): 404

Hint: The Certificate Authority failed to verify the temporary nginx configuration changes made by Certbot. Ensure the listed domains point to this nginx server and that it is accessible from the internet.

Is there a way that I can transfer the cert from one server to another easily? I have tried some instructions to move the entire letsencrypt folder from /etc but that seemed to be a disaster.

Can I put a file in the .well-known directory on my maps1.cachly.com server that will help this process?

The operating system my web server runs on is (include version): Ubuntu

I can login to a root shell on my machine (yes or no, or I don't know): Yes

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 3.3.0

For this case I would not migrate your certs from your Apache server to the newer one. Just create a cert fresh on your new server. So, delete any /etc/letsencrypt folder you made.

The command for nginx is below. Make sure you have a server block defined that listens on port 80 and your domain as server_name.

sudo certbot --nginx -d maps1.cachly.com

You need to have the public DNS and/or any local network routing such that requests to that domain go to the nginx server.

Right now requests to that domain get replied to by an Apache server.

You can see which one using a test site like: Let's Debug

2 Likes

Thank you! I got it all moved over successfully.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.