前提
- python2.7以上
- git 工具
下载letsencrypt项目,并进入该目录,执行生成免费SSL证书命令
git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
./letsencrypt-auto certonly --standalone --email IT@crosswaters.com -d test01.crosswaters.com
需要把apache 停掉
centos6.5命令service httpd stop
centos7命令systemctl stop httpd
看到Congratulations
说明生成免费SSL成功
证书会生成在 /etc/letsencrypt/live/YOURDOMAIN.com/目录下
更新证书
Let’s Encrypt证书的默认有效期只有90天,所以需要定时更新服务端的证书避免过期
一条命令更新所有服务端的证书
./letsencrypt-auto renew
如可报错
- 加如下参数
./letsencrypt-auto renew --no-self-upgrade
Upgrading certbot-auto 0.39.0 to 1.3.0...
Couldn't download https://raw.githubusercontent.com/certbot/certbot/v1.3.0/letsencrypt-auto-source/letsencrypt-auto. <urlopen error [Errno 111] Connection refused>
添加为定时任务, 编辑这个文件
sudo vi /etc/cron.monthly/letsencrypt_renew
添加如下内容:
!/bin/sh
/path/to/letsencrypt/letsencrypt-auto --debug renew > /var/log/letsencrypt/renew.log 2>&1
授予**/etc/cron.monthly/letsencrypt_renew**可执行权限
sudo chmod a+x /etc/cron.monthly/letsencrypt_renew
# 撤销证书
如果想收回(撤销)颁发给服务端的证书,可以使用如下命令
./letsencrypt-auto revoke --cert-path /etc/letsencrypt/live/subdomain.your_main_domain.com/cert.pem
# 在线HTTPS配置检查
可以使用[Jerry Qu](https://link.jianshu.com?t=https://imququ.com)推荐的两个在线HTTPS配置扫描服务来检查你的网站HTTPS配置的问题,并根据建议做相应的修复。
[Qualys SSL Labs's SSL Server Test](https://link.jianshu.com?t=https://www.ssllabs.com/ssltest/index.html)
[HTTP Security Report](https://link.jianshu.com?t=https://httpsecurityreport.com)