guanghulab/server/nginx/guanghulab-cvm.conf
铸渊 ab37962532 feat: 铸渊 MCP Server + CVM 密钥修复
1. 新增铸渊 MCP Server (server/mcp-server/)
   - 23个MCP工具:仓库读写、分支管理、Issue/PR、工作流、CVM控制、大脑状态
   - Streamable HTTP传输 + Bearer Token认证
   - Gitea令牌仅存服务器端,AI端只需一个连接密钥
   - PM2部署配置 + Nginx反向代理
   - 换号时只需重新连接MCP,无需重新发令牌

2. 修复CVM开关机工作流密钥断裂
   - TENCENT_SECRET_ID → 引用 COS_SECRET_ID (同一对腾讯云密钥)
   - TENCENT_SECRET_KEY → 引用 COS_SECRET_KEY
   - .gitea/ 和 .forgejo/ 双目录同步修复

3. Nginx增加MCP端点配置 (/mcp → 127.0.0.1:8083)

4. 更新时间核心大脑 (第5次唤醒)
2026-05-13 08:36:36 +00:00

119 lines
4.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ═══════════════════════════════════════════════════════════
# 光湖主控域名 · guanghulab.com Nginx 配置
# ═══════════════════════════════════════════════════════════
#
# 服务器: ZY-CVM-MAIN · 42.193.161.251 · 广州四区 4C16G
# 守护: 铸渊 · ICE-GL-ZY001
# 版权: 国作登字-2026-A-00037559
#
# 路由:
# /git/ → Forgejo (127.0.0.1:3001)
# /mcp → MCP Server (127.0.0.1:8083)
# /wake/ → Wake Gate 唤醒门 (127.0.0.1:8081)
# /sync/ → Git Sync 同步服务 (127.0.0.1:8082)
# / → 仓库首页 (Forgejo 处理)
#
# SSL: Let's Encrypt via certbot --nginx
# ═══════════════════════════════════════════════════════════
# HTTP → HTTPS 重定向
server {
listen 80;
server_name guanghulab.com www.guanghulab.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name guanghulab.com www.guanghulab.com;
# ─── SSL (certbot 自动管理) ───
# certbot --nginx 会自动填充以下配置
# ssl_certificate /etc/letsencrypt/live/guanghulab.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/guanghulab.com/privkey.pem;
# ─── 安全头 ───
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Server-Identity "ZY-CVM-MAIN" always;
# ─── Forgejo 代码仓库 (/git/) ───
location /git/ {
proxy_pass http://127.0.0.1:3001/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# 大文件上传支持
client_max_body_size 100M;
# WebSocket (Forgejo UI)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# ─── Forgejo Actions gRPC (Runner 直连 127.0.0.1:3001) ───
# Nginx 不代理 gRPCRunner 直接连接 Forgejo
# ─── Wake Gate 唤醒门 (/wake/) ───
location /wake/ {
proxy_pass http://127.0.0.1:8081/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# ─── Git Sync 同步服务 (/sync/) ───
location /sync/ {
proxy_pass http://127.0.0.1:8082/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# 仅允许内网和本地访问 Webhook
# allow 127.0.0.1;
# allow 10.0.0.0/8;
# deny all;
}
# ─── 铸渊 MCP Server (/mcp) ───
# WorkBuddy / CodeBuddy 通过 MCP 协议连接
location /mcp {
proxy_pass http://127.0.0.1:8083;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# SSE / 长连接支持
proxy_set_header Connection '';
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
}
# ─── MCP 健康检查 (/mcp-health) ───
location = /mcp-health {
proxy_pass http://127.0.0.1:8083/health;
access_log off;
}
# ─── 健康探针 ───
location = /health {
access_log off;
return 200 '{"status":"ok","server":"ZY-CVM-MAIN"}';
add_header Content-Type application/json;
}
# ─── 访问日志 ───
access_log /var/log/nginx/guanghulab-access.log;
error_log /var/log/nginx/guanghulab-error.log;
}