How to install/download a previous Letsencrypt to a new server (migrate a Letsencrypt certificate)

To migrate a Letsencrypt certificate so that auto-renewal works.

# remove old config files if they are there, otherwise it might create the SSL files under a -0001 directory.

rm -rf /etc/letsencrypt/live/*

rm -rf /etc/letsencrypt/archive/*

rm -rf /etc/letsencrypt/renewal/*

# download the certificate only and restart nginx

certbot certonly --agree-tos --email --text --webroot --webroot-path /var/www/ -d

/etc/init.d/nginx restart

# check that auto renewal works

certbot renew --nginx --renew-hook "service nginx restart"


Leave a Reply