Renew letsencrypt certificate with NGINX

linux
Published

August 24, 2020

If you have a default domain already configured with NGINX, the easiest way to renew manually a domain is to temporarily disable your custom domain and then use certbot-auto renew the certificate.

DOMAIN=www.yourdomain.com
sudo rm /etc/nginx/sites-enabled/$DOMAIN
sudo service nginx reload
sudo certbot-auto certonly -a webroot --webroot-path=/usr/share/nginx/html -d $DOMAIN
sudo ln -s /etc/nginx/sites-available/$DOMAIN /etc/nginx/sites-enabled/$DOMAIN
sudo service nginx reload