Skip to content
cccskills
FreePublished on GitHub

networking-gateway

网络网关与流量管理,覆盖 Nginx / Traefik / API Gateway。DNS 管理、SSL/TLS 证书、CDN 配置、负载均衡策略、流量路由。

The English summary is being prepared. Showing the original description.

See how to install

Files included (2)

  • SKILL.md5.2 KB
  • templates/nginx-config-template.md2.6 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

网络与网关(Networking & Gateway)

参考来源:Nginx 官方文档、Traefik 文档、AWS ALB/NLB 文档、Cloudflare 文档、Let's Encrypt / cert-manager 文档。

适用场景

  • 反向代理与负载均衡配置
  • API Gateway 设计(路由 / 限流 / 认证)
  • SSL/TLS 证书管理(自动续期)
  • DNS 记录管理与切换
  • CDN 配置与缓存策略
  • 多服务流量路由(路径 / 域名)
  • WebSocket / gRPC 代理
  • DDoS 防护与 WAF

核心原则

1. TLS Everywhere
   所有外部流量 HTTPS
   内部服务间 mTLS(Service Mesh)
   HSTS 强制

2. 最小暴露
   只暴露必要端口
   内部服务不直接对外
   安全组 / NetworkPolicy 限制

3. 高可用
   负载均衡多实例
   健康检查剔除故障节点
   DNS 多记录 / Failover

4. 缓存分层
   CDN → 反向代理 → 应用
   静态资源长缓存 + 版本化
   API 按需缓存

5. 限流保护
   全局限流 + 按 IP / 用户
   突发容忍 + 平滑限流
   429 返回 Retry-After

6. 可观测
   访问日志结构化
   延迟 / 错误率 / 流量指标
   实时流量可视化

7. 零停机变更
   配置热加载
   DNS 切换 TTL 提前降低
   蓝绿 / 金丝雀流量切分

工作流程

1. 网络架构设计
   - 外部流量入口(CDN → LB → Gateway)
   - 内部服务通信(Service Mesh / 直连)
   - 网络分段(公有 / 私有子网)

2. DNS 配置
   - 域名注册与托管
   - A / CNAME / ALIAS 记录
   - TTL 策略(正常 300s,切换前降至 60s)

3. SSL/TLS 证书
   - cert-manager 自动签发(Let's Encrypt)
   - 通配符证书(*.example.com)
   - 证书到期监控

4. 反向代理 / 网关
   - 路由规则(路径 / 域名 / Header)
   - 上游健康检查
   - 超时与重试配置
   - WebSocket / gRPC 支持

5. 负载均衡
   - 算法选择(Round Robin / Least Conn / IP Hash)
   - 会话保持(如需)
   - 跨 AZ 分布

6. 安全加固
   - WAF 规则(OWASP Top 10)
   - Rate Limiting
   - IP 白名单 / 黑名单
   - Bot 检测

7. CDN 配置
   - 静态资源缓存规则
   - 动态内容 bypass
   - 缓存失效策略(purge)

8. 监控与告警
   - 4xx / 5xx 错误率
   - P50 / P95 / P99 延迟
   - 带宽与连接数

技术选型

方案适用场景优势劣势
Nginx通用反向代理性能高、生态成熟配置复杂
TraefikK8s / Docker 原生自动发现、热加载高并发略逊
AWS ALBAWS 云原生托管免运维锁定云厂商
CloudflareCDN + WAF + DNS全球节点、DDoS 防护依赖第三方
KongAPI Gateway插件丰富运维复杂
EnvoyService MeshL7 能力强学习曲线高

Nginx 核心配置模式

# 反向代理 + 负载均衡
upstream backend {
    least_conn;
    server app1:3000 weight=3;
    server app2:3000 weight=1;
    keepalive 32;
}

server {
    listen 443 ssl http2;
    server_name api.example.com;

    ssl_certificate     /etc/ssl/cert.pem;
    ssl_certificate_key /etc/ssl/key.pem;

    # 安全头
    add_header Strict-Transport-Security "max-age=31536000" always;
    add_header X-Content-Type-Options nosniff;

    # 限流
    limit_req zone=api burst=20 nodelay;

    location / {
        proxy_pass http://backend;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_connect_timeout 5s;
        proxy_read_timeout 30s;
    }
}

质量自检

□ 所有外部流量走 HTTPS
□ HSTS 已启用
□ SSL 证书自动续期
□ 健康检查已配置(剔除故障节点)
□ Rate Limiting 已配置
□ 安全头已添加(HSTS / X-Content-Type / X-Frame)
□ 访问日志结构化输出
□ 超时合理设置(connect / read / write)
□ CDN 缓存规则正确(静态长缓存、API 不缓存)
□ DNS TTL 合理
□ WebSocket / gRPC 代理正确(如需)
□ 负载均衡算法合适
□ 跨 AZ / 多节点部署
□ WAF 规则已启用

常见坑

  1. 不配 HSTS——中间人降级攻击
  2. 证书过期——全站不可用
  3. 超时太长——慢请求拖垮连接池
  4. 不限流——单用户打爆服务
  5. CDN 缓存 API 响应——数据不一致
  6. DNS TTL 太长——切换生效慢
  7. 不转发真实 IP——日志全是 LB 地址
  8. WebSocket 无 upgrade——连接失败
  9. HTTP → HTTPS 不重定向——混合内容
  10. 负载均衡无健康检查——流量打到故障节点
  11. 通配符证书不续期——子域名全挂
  12. Nginx reload 不测试——配置错误导致宕机

配套模板

  • templates/nginx-config-template.md — Nginx 反向代理 + SSL + 限流完整配置模板

与其他 skill 的协作

上游:
  infrastructure-as-code → VPC / 子网 / LB 基础设施
  kubernetes-orchestration → Ingress Controller

下游:
  release-strategy → 流量切分(金丝雀 / 蓝绿)
  monitoring-alerting → 网关指标采集
  secrets-config → SSL 证书 / API Key 管理
  ci-cd-pipeline → DNS 切换自动化

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

A/B 测试设计与分析时使用。适用于产品实验、功能验证、转化率优化。融合假设驱动 + 样本量计算 + 置信度判断。

The English summary is being prepared. Showing the original description.

zhaoxuya520/AI-Fullstack-Delivery-Workflow53Updated May 19, 2026

上线前业务方/产品方验收时使用。适用于功能交付确认、UAT、发布会签。融合 BDD Given-When-Then、Specification by Example、ATDD。

The English summary is being prepared. Showing the original description.

zhaoxuya520/AI-Fullstack-Delivery-Workflow53Updated May 19, 2026

设计无障碍可访问的界面时使用。适用于满足 WCAG 标准、键盘导航、屏幕阅读器支持。优先使用 WCAG 2.2 AA 级标准 + 键盘 + 焦点 + 对比度 + ARIA。

The English summary is being prepared. Showing the original description.

zhaoxuya520/AI-Fullstack-Delivery-Workflow53Updated May 19, 2026

实现可访问性(无障碍)时使用。覆盖 WCAG 2.2 AA / ARIA / 键盘导航 / 屏幕阅读器 / 颜色对比 / 焦点管理。融合 React Aria / Radix UI / Headless UI 实践 + axe-core 自动化测试。

The English summary is being prepared. Showing the original description.

zhaoxuya520/AI-Fullstack-Delivery-Workflow53Updated May 19, 2026

AI 模型部署时使用。适用于推理服务 / GPU / TensorRT / 监控 / 扩缩容。

The English summary is being prepared. Showing the original description.

zhaoxuya520/AI-Fullstack-Delivery-Workflow53Updated May 19, 2026

数据分析报告输出时使用。适用于业务分析报告、周报、专项分析、决策支持。融合洞察 + 建议 + 行动项。

The English summary is being prepared. Showing the original description.

zhaoxuya520/AI-Fullstack-Delivery-Workflow53Updated May 19, 2026

See all skills by zhaoxuya520

Report a problem with this skill