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

推荐订阅源

WordPress大学
WordPress大学
T
Threatpost
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
月光博客
月光博客
V
Visual Studio Blog
T
Tailwind CSS Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
Jina AI
Jina AI
J
Java Code Geeks
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
Recorded Future
Recorded Future
C
Check Point Blog
腾讯CDC
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
罗磊的独立博客
Hacker News: Ask HN
Hacker News: Ask HN
SecWiki News
SecWiki News
博客园 - Franky
Hacker News - Newest:
Hacker News - Newest: "LLM"
N
News | PayPal Newsroom
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Cloudbric
Cloudbric
F
Full Disclosure
The Cloudflare Blog
Y
Y Combinator Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
S
Schneier on Security
Schneier on Security
Schneier on Security
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
AI
AI
N
News and Events Feed by Topic
T
Tor Project blog
P
Palo Alto Networks Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
G
Google Developers Blog

博客园 - 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;
}