❯ sudo apt-get install bc
❯ sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
❯ cd /opt/letsencrypt
❯ ./letsencrypt-auto certonly --standalone -d mydomain.com -d sub.mydomain.com -d sub2.mydomain.com
Auto-Renewal
As Let's Encrypt certificates expire after 90 days as a security precaution, you can set up auto-renewal via a crontab.
❯ sudo crontab -e
0 1 * * 1 systemctl stop nginx && /opt/letsencrypt/letsencrypt-auto renew && systemctl start nginx >> /var/log/letsencrypt-renewal.log