Letsencrypt, nginx使用certbot申请htt

2018-03-08  本文已影响0人  dannyvi

在python3环境安装certbot:

pip3 install certbot certbot-nginx

在nginx正常运行的情况下,以下自动完成申请,需要替换 email@youremail.comdomain.com 以及 -d 后面的域名为自己的域名:

certbot --nginx --agree-tos --redirect \
        -m email@youremail.com --eff-email \
        --preferred-challenges http-01 \
        --cert-name domain.com \
        -d domain.com,xyz.domain.com,www.domain.com  -q

申请完成后,默认分配文件到 /etc/letsencrypt 中,并且自动修改 /etc/nginx/conf.d/ 中的nginx配置文件 。

以下几个常用命令。
扩展域名:

certbot  --nginx --agree-tos -w /etc/letsencrypt --expand  \
        -d taskimage.com,www.taskimage.com,advice.domain.com,image.domain.com

为nginx生成配置文件:

certbot --nginx  install --cert-path /etc/letsencrypt/live/domain.com/  \
             --key-path /etc/letsencrypt/live/domain.com/privkey.pem  \
             --fullchain-path /etc/letsencrypt/live/domain.com/fullchain.pem  \
             -d domain.com,advice.domain.com,image.domain.com

简单申请新的证书:

certbot --nginx

会要求填写一系列信息。

只申请证书,不修改配置:

  certbot --nginx certonly
上一篇 下一篇

猜你喜欢

热点阅读