使用certbot-auto脚本安装Certbot 生成https证书

本文详细介绍了在CentOS7上安装Certbot的三种方法,包括使用RPM包、certbot-auto脚本及pip安装,并提供了配置nginx、生成SSL证书及定时更新证书的步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在CentOS7上安装Certbot有三种方式:

  1. 使用Certbot官方提供的对应平台的RPM包安装
  2. 使用Certbot官方的提供的certbot-auto安装
  3. 使用pip安装Certbot,因为Certbot是Python程序

参考文章

  1. https://www.yuzhi100.com/article/centos-7-install-lets-encrypt-certbot
  2. Certbot免费https证书-阿里云开发者社区

前置条件

  • 开发443端口

  • 关闭nginx

  1. 获取脚本  wget https://dl.eff.org/certbot-auto

  2. 执行权限  sudo chmod a+x ./certbot-auto

  3. 运行certbot命令生成证书   ./certbot-auto certonly --standalone --email 'sl166199@163.com' -d 'shilweb.com'

  4. nginx 配置

  5. 启动nginx 访问地址

过程中产生的问题

    1. 解决方式:

      1. pip install virtualenv

      2. pip install virtualenv

      3. 再重新生成

    1. 解决方式

      1. ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

      2. make

      3. 备份 cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak

      4. make install

      5. 在重新启动 ./nginx

进阶

  1. 定时更新

  2. /certbot-auto renew --force-renew

  3. 0 4 1 */2 * /root/renew-cert.sh >/root/crontab.log 2>&1

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值