let's encrypt (certbot)

2018-02-27  本文已影响0人  Lano_chazz

安装

添加源

$ yum -y install yum-utils
$ yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

测试certbot是否安装成功

$ sudo certbot certonly

可能会出现报错,对比需求的版本与当前版本是否一致,不用关系pyopenssl的问题,主要是request版本的问题

$ pip list 2>/dev/null | grep requests
$ rpm -q python-requests --queryformat '%{VERSION}\n'

如果不一样,则修改requests的版本:

$ pip install --upgrade --force-reinstall 'requests==2.6.0'

使用

$ sudo certbot certonly --webroot -w /var/www/example -d example.com -d www.example.com -w /var/www/thing -d thing.is -d m.thing.i
certbot certonly --standalone -d example.com -d www.example.com

更新证书

certbot renew --dry-run 
15 2 * */2 * certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start"

最后我们用 crontab 来启动这个定时任务

crontab certbot-auto-renew-cron
上一篇 下一篇

猜你喜欢

热点阅读