使用Let's encrypt保护你的网络通信

原始设置

webroot:
/home/wwwroot/baidu.com/

origin config:
ssl_certificate /home/ssl/www.baidu.com.crt;
ssl_certificate_key /home/ssl/www.baidu.com_nopass.key;

Shell:

wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
./certbot-auto certonly --webroot -w /home/wwwroot/baidu.com/ -d baidu.com -d www.baidu.com
ls /etc/letsencrypt/live/baidu.com/
  |-cert.pem
  |-chain.pem
  |-fullchain.pem
  |-privkey.pem

vi /usr/local/nginx/conf/nginx.conf

ssl_certificate /etc/letsencrypt/live/baidu.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/baidu.com/privkey.pem;

/usr/local/nginx/sbin/nginx -s reload

crontab -e
0 3 * * * /root/letsencrypt/certbot-auto renew >> /var/log/letsencrypt-renew.log
5 3 * * * /usr/local/nginx/sbin/nginx -s reload

很多东西写的不规范,仅供参考。

PS: ssl_certificate 使用cert.pem和fullchain.pem都可以使用,没发现有啥区别,谁了解请知会一声。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值