User Tools

Site Tools


Sidebar

linux:certbot_move_cert_to_server

This is an old revision of the document!


Migrate Let's Encrypt Certificates (certbot) to a New Server

Archive SSL certificates

First of all, you should find the actual location of the certificates. You can open your nginx or apache configuration to see the location:

cat /etc/nginx/sites-enabled/divbyte.com
...
 ssl_certificate /etc/letsencrypt/live/divbyte.com/fullchain.pem; # managed by Certbot
 ssl_certificate_key /etc/letsencrypt/live/divbyte.com/privkey.pem; # managed by Certbot
...

But this is not the actual place where certificates are located. These are symlinks, to see the actual location you should execute the following command:

sudo ls -l /etc/letsencrypt/live/divbyte.com
total 0
lrwxrwxrwx 1 root root 46 Mar 25 13:23 cert.pem -> /etc/letsencrypt/archive/divbyte.com/cert2.pem
lrwxrwxrwx 1 root root 47 Mar 25 13:24 chain.pem -> /etc/letsencrypt/archive/divbyte.com/chain2.pem
lrwxrwxrwx 1 root root 51 Mar 25 13:24 fullchain.pem -> /etc/letsencrypt/archive/divbyte.com/fullchain2.pem
lrwxrwxrwx 1 root root 49 Mar 25 13:24 privkey.pem -> /etc/letsencrypt/archive/divbyte.com/privkey2.pem

You also need to archive renewal config for your website. It's located in the /etc/letsencrypt/renewal/<domain>/ folder. To archive all files, run the following:

sudo tar -chvzf certs.tar.gz /etc/letsencrypt/archive/divbyte.com /etc/letsencrypt/renewal/divbyte.com.conf

Now you can copy this archive to the web site location, so you can download it to the new server in the next step:

scp certs.tar.gz admin@sevennet.org:/home/admin/

Replace admin@sevennet.org with the destination server info, where admin is a username and sevennet.org is a target server domain or IP.

linux/certbot_move_cert_to_server.1592424900.txt.gz · Last modified: 2020/06/17 22:15 by admin