certbot

certbot

官方安装介绍

到上面网站按照步骤安装certbot,安装完成后,certbot 生成证书有两种方式

第一种:standalone模式,certbot 会启动自带的nginx(如果服务器上已有nginx,需要停止已有的nginx)生成证书

1
certbot certonly --standalone -d example.com -d www.example.com

第二种:webroot模式

certbot会生成随机文件到给定目录(nginx配置的网页目录)下的/.well-known/acme-challenge/目录里面,并通过已经启动的nginx验证随机文件,生成证书

1
certbot certonly --webroot -w /usr/local/nginx/html -d linlc.cc -d xcx.linlc.cc -w /var/www/doee -d doee.cc
  • -w nginx.conf 里server配置的网页目录,既生成随机验证的文件的目录
  • -d nginx.conf 里的 server_name

$续期:# 最后如果要续期,(正式 去掉 –dry-run 参数)

1
2
3
4
certbot renew --dry-run

# 查询已经生成证书的情况
certbot certificates

$通配符:生成通配符域名(一定要加 *.linlc.cc 与 linlc.cc 这两个,否则不会生成顶级域名的证书)

1
certbot certonly --server https://acme-v02.api.letsencrypt.org/directory --manual --preferred-challenges dns-01 -w /usr/local/nginx/html -d *.linlc.cc -d linlc.cc -d timed.ink

只需要跟换 -w, -d 后面的参数就行了