使用certbot-auto脚本安装Certbot

在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. https://yq.aliyun.com/articles/138272

前置条件

  • 开发443端口

  • 关闭nginx

 

  1. 获取脚本  wget https://dl.eff.org/certbot-auto使用certbot-auto脚本安装Certbot

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

  3. 运行certbot命令生成证书   ./certbot-auto certonly --standalone --email '[email protected]' -d 'shilweb.com'使用certbot-auto脚本安装Certbot

  4. nginx 配置使用certbot-auto脚本安装Certbot

  5. 启动nginx 访问地址使用certbot-auto脚本安装Certbot使用certbot-auto脚本安装Certbot

过程中产生的问题

  1. 使用certbot-auto脚本安装Certbot

    1. 解决方式:

      1. pip install virtualenv

      2. pip install virtualenv

      3. 再重新生成

  2. 使用certbot-auto脚本安装Certbot

    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. 定时更新使用certbot-auto脚本安装Certbot

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

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