yum install -y epel-* yum install certbot # 申请证书 certbot certonly -d d1.rootop.org --webroot -w /usr/share/nginx/html/d1/ -m xxx@xxx.com -n -d 指定域名 --webroot 是使用文件验证方式,会在网站根目录下自动创建文件夹及验证文件 -w 指定网站根目录路径 -m 指定一个邮箱 -n 不交互 申请 # nginx访问日志可以看到是进行文件验证 23.178.112.202 - - [27/Jun/2023:09:16:37 +0800] "GET /.well-known/acme-challenge/ziAcQFRDITwWwCjYzpeISyTXKmyX47lAM4xD0-cZOKA HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" "-" # 证书路径 /etc/letsencrypt/live/域名/ # 官网限制7天只能重复申请5次 # 证书到期前30天可以再次申请,也可以强制重新申请 certbot renew --force-renew --deploy-hook "nginx -t && nginx -s reload" --deploy-hook 是申请证书以后执行一个命令,这里实现重启nginx重新载入证书。 # 查看当前所有证书的信息 certbot certificates certbot 强制更新证书只用加上 --force-renewal 参数, 执行命令 certbot renew --force-renewal即可。 如果是想更新指定的证书使用参数 --cert-name x.x.com certbot renew --cert-name x.x.com --force-renewal
原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/5236.html