- 新增独立 certbot 服务项目 - nginx 配置添加 HTTPS 8443 端口监听 - frpc.toml HTTPS 代理指向 nginx:8443 - 支持自动续签并重载 nginx - 共享 Docker volume 传递证书
36 lines
748 B
Bash
Executable File
36 lines
748 B
Bash
Executable File
#!/bin/bash
|
|
# Let's Encrypt 证书初始化脚本
|
|
# 用法: ./init-cert.sh <域名> [邮箱]
|
|
|
|
set -e
|
|
|
|
DOMAIN=$1
|
|
EMAIL=${2:-"admin@stonelan.cn"}
|
|
|
|
if [ -z "$DOMAIN" ]; then
|
|
echo "用法: $0 <域名> [邮箱]"
|
|
echo "示例: $0 fastgpt.stonelan.cn admin@example.com"
|
|
exit 1
|
|
fi
|
|
|
|
echo "开始为域名 $DOMAIN 申请证书..."
|
|
|
|
# 确保 certbot 容器运行
|
|
docker compose up -d
|
|
|
|
# 等待容器启动
|
|
sleep 5
|
|
|
|
# 申请证书(使用 webroot 验证方式)
|
|
docker compose exec certbot certbot certonly \
|
|
--webroot \
|
|
--webroot-path=/var/www/certbot \
|
|
--email "$EMAIL" \
|
|
--agree-tos \
|
|
--no-eff-email \
|
|
-d "$DOMAIN" \
|
|
--force-renewal
|
|
|
|
echo "证书申请完成!"
|
|
echo "证书路径: /etc/letsencrypt/live/$DOMAIN/"
|