Skip to content

Instantly share code, notes, and snippets.

@llccing
Created April 17, 2024 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save llccing/fb5474fd2673070527478a525651fde3 to your computer and use it in GitHub Desktop.
Save llccing/fb5474fd2673070527478a525651fde3 to your computer and use it in GitHub Desktop.
#!/bin/bash
# 确保脚本以 root 权限运行
if [ "$EUID" -ne 0 ]
then echo "请以 root 权限运行"
exit
fi
# 更新系统包列表
echo "更新系统包列表..."
apt update
# 安装 Certbot 和 Nginx 的 Certbot 插件
echo "正在安装 Certbot 及其 Nginx 插件..."
apt install -y certbot python3-certbot-nginx
# 运行 Certbot 为 Nginx 配置 SSL
echo "运行 Certbot 为 Nginx 配置 SSL..."
certbot --nginx
# 设置自动续期
echo "正在设置自动续期"
sudo certbot renew --dry-run
echo "Certbot 安装和配置完成!"
# check status
sudo certbot certificates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment