- 新增 server/git-sync/ — 监听 Gitea Webhook,push/merge 到 main 时自动 git pull - 修改 selfcheck — 移除 git pull 步骤(由 Git Sync 负责),添加 Git Sync/Wake Gate 状态检查 - 更新 README — 添加自动同步说明,更新仓库结构 - 新增 server/nginx/guanghulab-cvm.conf — 新服务器 Nginx 配置模板 解决: PR合并后代码不会自动同步到服务器的问题 冰朔只需在Gitea点合并,服务器自动更新代码
94 lines
3.5 KiB
Plaintext
94 lines
3.5 KiB
Plaintext
# ═══════════════════════════════════════════════════════════
|
||
# 光湖主控域名 · guanghulab.com Nginx 配置
|
||
# ═══════════════════════════════════════════════════════════
|
||
#
|
||
# 服务器: ZY-CVM-MAIN · 42.193.161.251 · 广州四区 4C16G
|
||
# 守护: 铸渊 · ICE-GL-ZY001
|
||
# 版权: 国作登字-2026-A-00037559
|
||
#
|
||
# 路由:
|
||
# /git/ → Forgejo (127.0.0.1:3001)
|
||
# /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 不代理 gRPC,Runner 直接连接 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;
|
||
}
|
||
|
||
# ─── 健康探针 ───
|
||
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;
|
||
}
|