# gch3n.online - Caddy 配置文件
# 自动 HTTPS，无需手动申请证书

# Git 服务器
git.gch3n.online {
    reverse_proxy localhost:8080
    
    # 日志
    log {
        output file /var/log/caddy/git.gch3n.online.log
    }
}

# 应用部署（蓝绿）
app.gch3n.online {
    # 负载均衡到 blue/green
    reverse_proxy localhost:3001 localhost:3002 {
        lb_policy round_robin
        health_uri /health
        health_interval 10s
        health_timeout 5s
    }
    
    log {
        output file /var/log/caddy/app.gch3n.online.log
    }
}

# 主域名 - 静态展示页
gch3n.online {
    # 静态文件目录
    root * /var/www/gch3n
    
    # 尝试文件
    try_files {path} {path}/ /index.html
    
    # 文件服务
    file_server
    
    # 压缩
    encode gzip
    
    log {
        output file /var/log/caddy/gch3n.online.log
    }
}
