服务器环境
Linux版本: CentOS Linux release 7.5.1804
Apache版本:2.4.6
参考
详细步骤
- yum -y install yum-utils
- yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
- 报错:Loaded plugins: fastestmirror
- 解决
vim /etc/yum/pluginconf.d/fastestmirror.conf(原:enabled=1)
enabled = 0
vim /etc/yum.conf(原:plugins=1)
plugins=0
yum clean dbcache
- yum install python2-certbot-apache
- certbot --apache
此时开始安装更改配置
- Which names would you like to activate HTTPS for?
选择需要支持HTTPS的网址 - Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
选择是否将HTTP请求重定向至HTTPS
- certbot renew --dry-run
自动续订
crontab -e
0 0,12 * * * python -c ‘import random; import time; time.sleep(random.random() * 3600)’ && certbot renew
注意:
Linux定时任务 crontab 执行者root和 其他用户 可能会冲突,或者配置的时候由root创建的定时任务不会执行