feat: 添加 Let's Encrypt SSL 证书管理
- 新增独立 certbot 服务项目 - nginx 配置添加 HTTPS 8443 端口监听 - frpc.toml HTTPS 代理指向 nginx:8443 - 支持自动续签并重载 nginx - 共享 Docker volume 传递证书
This commit is contained in:
27
certbot/renew-cert.sh
Executable file
27
certbot/renew-cert.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
# Let's Encrypt 证书自动续签脚本
|
||||
# 续签后自动重载 nginx
|
||||
|
||||
set -e
|
||||
|
||||
echo "开始检查证书续签..."
|
||||
|
||||
# 执行续签
|
||||
docker compose exec certbot certbot renew \
|
||||
--webroot \
|
||||
--webroot-path=/var/www/certbot \
|
||||
--quiet
|
||||
|
||||
# 检查是否有证书被续签
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "证书续签检查完成"
|
||||
|
||||
# 重载 nginx(发送 HUP 信号)
|
||||
echo "重载 nginx 配置..."
|
||||
docker kill -s HUP nginx-proxy 2>/dev/null || echo "nginx-proxy 容器未运行或不存在"
|
||||
|
||||
echo "续签流程完成"
|
||||
else
|
||||
echo "证书续签失败"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user