Letsencrypt, nginx使用certbot申请https证书和部署

在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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容