Created
April 17, 2024 07:05
-
-
Save llccing/fb5474fd2673070527478a525651fde3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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