惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Check Point Blog
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
IT之家
IT之家
月光博客
月光博客
U
Unit 42
K
Kaspersky official blog
T
Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
云风的 BLOG
云风的 BLOG
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
Engineering at Meta
Engineering at Meta
Recorded Future
Recorded Future
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security @ Cisco Blogs
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
Security Archives - TechRepublic
Security Archives - TechRepublic
Webroot Blog
Webroot Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Schneier on Security
S
Secure Thoughts
The Register - Security
The Register - Security
B
Blog RSS Feed
The Last Watchdog
The Last Watchdog
P
Palo Alto Networks Blog
爱范儿
爱范儿
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
L
LINUX DO - 热门话题
C
Cisco Blogs
Spread Privacy
Spread Privacy
F
Full Disclosure
博客园 - 聂微东
T
The Blog of Author Tim Ferriss

博客园 - AuOK?

深夜发文,惨痛教训,在redis集群中,不能使用 multi docker-compose 记录一个让人抓狂的错误 SVN 同一个仓库下,不同目录的自动更新方法 写点正则表达式的 MySQL 事务嵌套的方法 go mod PHP笔记 NGINXConfig windows 下修改文件属性值 nextcloud 应用开发 记录一下搞nextcloud的辛酸事吧 nextcloud环境搭建及部署 docker容器内访问宿主机,访问不通 错误:Host is unreachable 记录一下SQL的行行比较 记录一次nginx平滑升级 守护进程因echo挂掉的原因,以及重定向标准输入、标准输出和标准错误 openresty lua-nginx-module模块中文文档 记录一下,php正则获取字符串子串技巧 nginx localhost的坑
letsencrypt免费SSL证书自动续期
AuOK? · 2021-06-24 · via 博客园 - AuOK?
#!/bin/bash

install_snapd(){
  echo "install snap..."
  yum install -y snapd
}

install_snapd_core(){
  if [ $(systemctl status snapd.service | grep -c '(running)') -lt 1 ];then
    systemctl restart snapd.service
  fi
  echo "install snap core..."
  snap install core && snap refresh core
}

install_certbot(){
  echo "install certbot..."
  ln -s /var/lib/snapd/snap /snap
  snap install --classic certbot
  if [ $(whereis certbot | grep -c '/') -lt 1 ];then
    ln -s /var/lib/snapd/snap/bin/certbot /usr/bin/certbot
  fi
}

if [ $(yum list installed | grep -c "snapd.x86_64") -lt 1 ];then
  echo "正在安装依赖包..."
  install_snapd
  sleep 1
  install_snapd_core
  sleep 1
  install_certbot
fi

case $1 in
'list')
  certbot certificates
  ;;
'add')
  echo "请输入网站根目录:"
  read webroot
  echo "请输入网站对应的域名,多个域名用逗号隔开:"
  read domain
  certbot certonly --webroot -w ${webroot} -d ${domain}
  ;;
'update')
  echo "正在更新所有已安装证书..."
  certbot renew
  ;;
'cron')
  echo "安装定时更新证书任务"
  user=`who am i | awk '{print $1}'`
  cron_path=/var/spool/cron/${user}
  if [ ! -f ${cron_path} ];then
    echo "${cron_path} 定时任务文件不存在"
    exit 0
  fi
  if [ $(cat ${cron_path} | grep -c 'certbot renew') -lt 1 ];then
    command="certbot renew -q --deploy-hook '/usr/local/openresty/nginx/sbin/nginx -s reload'"
    echo "30 5 1 * * ${command}" >> ${cron_path}
  fi
  echo "安装完成"
  ;;
*)
  echo "list    查看所有已安装的证书"
  echo "add     安装证书"
  echo "update  更新所有已安装且30天内到期的证书"
  echo "cron    安装定时更新证书任务"
  echo "更多certbot命令请访问:https://certbot.eff.org/docs/using.html#certbot-commands"
  ;;
esac

在certbot certonly --webroot时,如果发现 http://你的域名/.well-known/acme-challenge/HGr8U1IeTW4kY_Z6UIyaakzOkyQgPr_7ArlLgtZE8SX验证失败,需要在网站的配置文件里,设置.well-known文件夹下允许访问。

#nginx

listen 80;
...

location ~ /.well-known {
    allow all;
}