免费二级域名 xxx.duckdns.org
https://www.duckdns.org/ 前往进行自己域名申请,绑定IP地址。
sudo apt install certbot例如在 duckdns.org 申请了二级域名,mfavant.duckdns.org
sudo certbot certonly --standalone --preferred-challenges tls-alpn-01 -d mfavant.duckdns.org根据提示输入同意、邮箱地址等。
root@ser745692301841:~# sudo certbot certonly --standalone --preferred-challenges tls-alpn-01 -d mfavant.duckdns.org
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for mfavant.duckdns.org
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/mfavant.duckdns.org/fullchain.pem
Key is saved at: /etc/letsencrypt/live/mfavant.duckdns.org/privkey.pem
This certificate expires on 2026-03-31.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
* Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
* Donating to EFF: https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -可以看见生成的证书放在了
Certificate is saved at: /etc/letsencrypt/live/mfavant.duckdns.org/fullchain.pem
Key is saved at: /etc/letsencrypt/live/mfavant.duckdns.org/privkey.pem查看已经申请的证书
root@ser745692301841:~# sudo certbot certificates
Saving debug log to /var/log/letsencrypt/letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Found the following certs:
Certificate Name: mfavant.duckdns.org
Serial Number: 65636c13491f6f4416dc4e2af0542f36764
Key Type: ECDSA
Domains: mfavant.duckdns.org
Expiry Date: 2026-03-31 06:40:58+00:00 (VALID: 89 days)
Certificate Path: /etc/letsencrypt/live/mfavant.duckdns.org/fullchain.pem
Private Key Path: /etc/letsencrypt/live/mfavant.duckdns.org/privkey.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -删除已经申请的证书
sudo certbot delete --cert-name mfavant.duckdns.org配置后重启服务器,重启下浏览器,一般有证书缓存,容易提示网站不安全。