Centos7-nginx部署let’s encrypt证书
配置环境
软件 | 版本 |
---|---|
Nginx | 1.14.2 |
Centos | CentOS Linux release 7.6.1810 (Core) |
安装certbot
1 | yum -y install yum-utils |
生成证书
webroot方式-基于本地有web服务器生成,需要域名能访问80端口
1
certbot certonly --webroot -w /data/wwwroot/example -d example.com
说明:certainly 表明只生成证书
-w 网站目录
-d 配置https的域名
standalone方式 独立生成
1
certbot certonly --standalone -d example.com
证书生成地址
证书地址:/etc/letsencrypt/live/example.com/fullchain.pem
私钥地址:/etc/letsencrypt/live/example.com/prikkey.pem
配置nginx
1 | # HTTPS server nginx-1.14.2 |
Crontab 自动 续期(每两天执行证书续期)
1 | crontab -e |
Certbot 其他命令
查看证书
1
certbot certificates
更改现有证书的域
1
certbot certonly --cert-name exist.com -d newexample.com,www.newexample.com
删除系统中证书的相关文件
1
certbot delete --cert-name example.com