Generate an HTTPS certificate for free with Let's Encrypt
- Download Install Certbot (let ' s Encrypt)
- Generate certificates with Certbot
- Configuring an Nginx HTTPS certificate
Installing Cerbot
[Email protected] ~]# wget https://dl.eff.org/certbot-auto[[email protected] ~]# chmod a+x certbot-auto[[email Protected] ~]#./certbot-auto
Generate certificates with Certbot
Generate a certificate for a domain name
[email protected] certbot]#./certbot-auto certonly--email [email protected]--agree-tos--webroot-w/ALIDATA1/WWW/TIMECASH22/API3-D xxxx.zjm.cn/root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py: -: Deprecationwarning:python2.6 isNo longer supported by the Python core team, please upgrade your python. A future version of cryptography would drop support forPython2.6deprecationwarningsaving Debug Log to/var/log/letsencrypt/letsencrypt.logobtaining aNewcertificateperforming the following challenges:http- onChallenge forxxx.zjm.cnUsing the Webroot path/alidata1/www/timecash22/api3 forAll unmatched domains. Waiting forverification ... Cleaning up challengesimportant NOTES:-congratulations!Your certificate and chain has been saved at/etc/letsencrypt/live/xxx.zjm.cn/Fullchain.pem. Your cert would expire on .- the- .. To obtain aNewor tweaked version of ThisCertificateinchThe future, simply run certbot-Auto again. to non-interactively Renew *all*of your certificates, run"Certbot-auto Renew"-If You like Certbot, please consider supporting we work by:donating to ISRG/Let's Encrypt:https://letsencrypt.org/donateDonating to Eff:https://Eff.org/donate-le
-W: Specifies the root directory of the domain-D: Specify the domain name
Note: The certificate has been generated under/etc/letsencrypy/live/xxx.zjm.cn
Nginx Configuring HTTPS Certificates
server { 443 SSL; .... /etc/letsencrypt/live/xxx.zjm.cn/Fullchain.pem; /etc/letsencrypt/live/xxx.zjm.cn/Privkey.pem; /etc/nginx/ssl/Dhparam.pem; }
ssl_certificate and ssl_certificate_key respectively correspond to FULLCHAIN.PEM,PRIVKEY.PEM
Ssl_dhparam is generated by the following command
$ sudo mkdir/etc/nginx/-out2048
Generate one certificate for multiple domain names, i.e. multiple domain names using one SSL certificate
./certbot-auto certonly--email [email protected]--agree-tos--webroot-w/var/www/laozuo-d laozuo.org-d WWW.L Aozuo.org-w/var/www/laobuluo-d laobuluo.com-d www.laobuluo.com
Automatically update HTTPS certificates
Since this free certificate is only available for 90 days, it is time to update the following certificate periodically, which is to use Certbot to automatically update the certificate at regular intervals.
Perform updates manually
./certbot-auto Renew--dry-run
Combine crontab to automatically update certificates every once in a while
- 2 1 ./certbot-auto Renew >>/var/log/le-renew.log
Domain name Add HTTPS