Received a certificate renewal notification from Tencent Cloud, but
when applying for a new certificate, I found out that Tencent Cloud no
longer offers free one-year certificates:
Starting from April 25, 2024, the validity period of new free
certificates issued by Tencent Cloud will be adjusted to 90 days.
Since I’ve always updated certificates manually, doing it every three
months feels quite tedious. So, I decided to explore Certbot from Let's
Encrypt. My only concern was how to prove ownership of a subdomain.
After trying it out, I realized this wasn’t an issue at all, as Certbot
only issues certificates and doesn’t pose any threat to the website
itself.
Here are the configuration steps for Certbot. In fact, it’s very
simple and only requires running a few commands.
Installing Certbot
Here, I chose to install Certbot using apt instead of
the recommended snap. Personally, I find snap
to be too heavy compared to the lightweight nature of apt.
I also prefer not to see a bunch of unnecessary snap
entries cluttering the output of df -lh.
1 2
$ apt update $ apt install certbot
Obtaining a Certificate
The command to obtain a certificate is straightforward:
1 2 3 4
$ certbot certonly --nginx -d yourdomain.com Saving debug log to /var/log/letsencrypt/letsencrypt.log The requested nginx plugin does not appear to be installed Ask forhelp or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
If you encounter the error:
The requested nginx plugin does not appear to be installed,
you need to install the following package:
$ certbot certonly --nginx -d yourdomain.com Saving debug log to /var/log/letsencrypt/letsencrypt.log Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): xx@gmail.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.4-April-3-2024.pdf. You must agree in order to register with the ACME server. Do you agree? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: (Y)es/(N)o: Y
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing, once your first certificate is successfully issued, to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: N Account registered. Requesting a certificate for yourdomain.com
Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/yourdomain.com/fullchain.pem Key is saved at: /etc/letsencrypt/live/yourdomain.com/privkey.pem This certificate expires on 2025-02-15. These files will be updated when the certificate renews. Certbot has set up a scheduled task to automatically renew this certificate in the background.
Since this is the first time running Certbot, you’ll need to answer a
few questions, such as providing an emergency email and agreeing to the
terms of service. Once completed, the certificate files will be stored
in the /etc/letsencrypt/live/yourdomain.com/ directory.
For subsequent renewals, these questions won’t be asked again, and
the process can be completed with a single command:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
$ certbot certonly --nginx -d yourdomain.com Saving debug log to /var/log/letsencrypt/letsencrypt.log Requesting a certificate for yourdomain.com
Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/yourdomain.com/fullchain.pem Key is saved at: /etc/letsencrypt/live/yourdomain.com/privkey.pem This certificate expires on 2025-02-15. These files will be updated when the certificate renews. Certbot has set up a scheduled task to automatically renew this certificate in the background.