博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
配置Let's Encrypt的https证书
阅读量:2342 次
发布时间:2019-05-10

本文共 1522 字,大约阅读时间需要 5 分钟。

配置Let's Encrypt的https证书

1、下载解压

$ cd /root$ wget https://github.com/certbot/certbot/archive/master.zip $ unzip master.zip$ cd certbot-master/​# 查看帮助$ ./certbot-auto --help

2、生成证书, 证书有效期90天

# 例子: $ ./certbot-auto certonly --standalone --agree-tos -v -t --email bell.zhouxiaobing@staginfo.com -d siot.staginfo.com# 例子: $ ./certbot-auto certonly --webroot -w /usr/local/nginx/html --email bell.zhouxiaobing@staginfo.com -d siot.staginfo.com# --webroot -w 后面路径是apache或nginx的静态部署的根路径文件夹# --standalone 会启动内置的webserver, 同时80端口不能够被占用,不然会报错:Problem binding to port 80: Could not bind to IPv4 or IPv6# (将邮箱地址和服务器域名替换)$ ./certbot-auto certonly --webroot -w /usr/local/nginx/html \    --email 
\ -d
<域名>

3、生成的https证书路径

# 例子: cd /etc/letsencrypt/live/siot.staginfo.com$ ls /etc/letsencrypt/live/
<域名>
# 文件夹下的文件:cert.pem chain.pem fullchain.pem privkey.pem README

4、重新生成证书

# --no-self-upgrade 不更新certbot# --force-renew     强制更新证书 $ ./certbot-auto renew

5、自动更新证书脚本

$ cd /root$ vi ssl_auto_auth.sh
#/bin/sh datetime=`date '+%Y-%m-%d %H:%M:%S'`;echo "[$datetime] [certbot-auto renew]"# ps: 注意检查certbot-master的路径是否正确/root/certbot-master/certbot-auto renew --no-self-upgrade​echo "[$datetime] [nginx restart]"# ps: 注意检查nginx的路径是否正确/usr/local/nginx/sbin/nginx -s reload​echo "[$datetime] [ok]"echo "=============end================"

6、配置定时任务(每月1号凌晨2点执行)

$ crontab -e# 每月1号凌晨2点执行# ps: 注意脚本的路径是否一致0 2 1 * * /root/ssl_auto_auth.sh >>ssl_auto_auth.log 2>&1# 1分钟运行一次测试*/1 * * * * /root/ssl_auto_auth.sh >>ssl_auto_auth.log 2>&1

 

转载地址:http://oiyvb.baihongyu.com/

你可能感兴趣的文章
CvMat用法详解
查看>>
std::sort的详细用法
查看>>
协方差与协方差矩阵
查看>>
std::mutex 和 std::lock_guard 小例子
查看>>
printf()函数不能直接输出string类型
查看>>
AprilTag视觉定位系统
查看>>
cairo学习简单总结
查看>>
彻底搞懂四元数
查看>>
四元数与欧拉角(RPY角)的相互转换
查看>>
bundle adjustment算法学习
查看>>
Structure from Motion 资料总结
查看>>
Eigen库使用教程之旋转矩阵,旋转向量和四元数的初始化和相互转换的实现
查看>>
Absolute Orientation - Horn's method
查看>>
谈谈gnuplot(五):坐标取值范围及刻度
查看>>
从Intel和ARM双雄争霸读懂芯片的前世今生
查看>>
Android Studio教程从入门到精通
查看>>
Android Studio的下载、安装与配置
查看>>
kalibr 如何从bag中提取图像/由图像生成bag
查看>>
ROS编译:catkin简析
查看>>
catkin 编译之后,直接更改目录导致的错误
查看>>