Let‘s Encrypt 获取Https证书 假设安装目录:/root/letsencrypt(在线方式申请:https://easy.zhetao.com/)
1.cd root目录安装git yum -y install git
2.输入 git clone https://github.com/letsencrypt/letsencrypt
3.cd letsencrypt
4.chmod +x letsencrypt-auto
5.安装证书
./letsencrypt-auto certonly --email 1649747584@qq.com -d networkstar.wang
6.自动续签:
a:执行 crontab -e
b:添加下面的配置
00 00 * * * /root/letsencrypt/certbot-auto renew --force-renewal --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" >> /root/letsencrypt/letsencry.log 2>&1
7.ngix配置证书
listen 443 ssl;
ssl on;
ssl_certificate /root/letsencrypt/live/XXX.com/fullchain.pem;
ssl_certificate_key /root/letsencrypt/live/XXX.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;