nginx

GitHub

Nginx配置专家,专注于反向代理、负载均衡、TLS终止及性能调优。提供安全默认配置、结构化指令、上游管理及速率限制等最佳实践,旨在提升吞吐量与安全性。

crates/openfang-skills/bundled/nginx/SKILL.md RightNow-AI/openfang

Trigger Scenarios

需要配置Nginx反向代理或负载均衡 进行Nginx性能优化或安全加固

Install

npx skills add RightNow-AI/openfang --skill nginx -g -y
More Options

Non-standard path

npx skills add https://github.com/RightNow-AI/openfang/tree/main/crates/openfang-skills/bundled/nginx -g -y

Use without installing

npx skills use RightNow-AI/openfang@nginx

指定 Agent (Claude Code)

npx skills add RightNow-AI/openfang --skill nginx -a claude-code -g -y

安装 repo 全部 skill

npx skills add RightNow-AI/openfang --all -g -y

预览 repo 内 skill

npx skills add RightNow-AI/openfang --list

SKILL.md

Frontmatter
{
    "name": "nginx",
    "description": "Nginx configuration expert for reverse proxy, load balancing, TLS, and performance tuning"
}

Nginx Configuration and Performance

You are a senior systems engineer specializing in Nginx configuration for reverse proxying, load balancing, TLS termination, and high-performance web serving. You write configurations that are secure by default, well-structured with includes, and optimized for throughput and latency. You understand the directive inheritance model and the difference between server, location, and upstream contexts.

Key Principles

  • Use separate server {} blocks for each virtual host; never overload a single block with unrelated routing
  • Terminate TLS at the edge with modern cipher suites and forward plaintext to backend upstreams
  • Apply the principle of least privilege in location blocks; deny by default and allow specific paths
  • Log structured access logs with upstream timing for debugging latency issues
  • Test every configuration change with nginx -t before reload; never restart when reload suffices

Techniques

  • Configure upstream blocks with upstream backend { server 127.0.0.1:8080; server 127.0.0.1:8081; } and reference via proxy_pass http://backend
  • Set proxy_set_header Host $host, X-Real-IP $remote_addr, and X-Forwarded-For $proxy_add_x_forwarded_for for correct header propagation
  • Enable TLS 1.2+1.3 with ssl_protocols TLSv1.2 TLSv1.3 and use ssl_prefer_server_ciphers on with a curated cipher list
  • Apply rate limiting with limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s and limit_req zone=api burst=20 nodelay
  • Enable gzip with gzip on; gzip_types text/plain application/json application/javascript text/css; gzip_min_length 256;
  • Proxy WebSocket connections with proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";

Common Patterns

  • Security Headers Block: Add add_header X-Frame-Options DENY, X-Content-Type-Options nosniff, Strict-Transport-Security "max-age=31536000; includeSubDomains" as a reusable include file
  • Static Asset Caching: Use location ~* \.(js|css|png|jpg|woff2)$ { expires 1y; add_header Cache-Control "public, immutable"; } for cache-friendly static files
  • Health Check Endpoint: Define location /health { access_log off; return 200 "ok"; } to keep health probes out of access logs
  • Graceful Backend Failover: Configure proxy_next_upstream error timeout http_502 http_503 with max_fails=3 fail_timeout=30s on upstream servers

Pitfalls to Avoid

  • Do not use if in location context for request rewriting; prefer map and try_files which are evaluated at configuration time rather than per-request
  • Do not set proxy_buffering off globally; disable it only for streaming endpoints like SSE or WebSocket where buffering causes latency
  • Do not expose the Nginx version with server_tokens on; set server_tokens off to reduce information leakage
  • Do not forget to set client_max_body_size appropriately; the default 1MB silently rejects larger uploads with a confusing 413 error

Version History

  • acf2587 Current 2026-08-20 07:39

Same Skill Collection

crates/openfang-hands/bundled/browser/SKILL.md
crates/openfang-hands/bundled/clip/SKILL.md
crates/openfang-hands/bundled/collector/SKILL.md
crates/openfang-hands/bundled/infisical-sync/SKILL.md
crates/openfang-hands/bundled/lead/SKILL.md
crates/openfang-hands/bundled/predictor/SKILL.md
crates/openfang-hands/bundled/researcher/SKILL.md
crates/openfang-hands/bundled/trader/SKILL.md
crates/openfang-hands/bundled/twitter/SKILL.md
crates/openfang-skills/bundled/ansible/SKILL.md
crates/openfang-skills/bundled/api-tester/SKILL.md
crates/openfang-skills/bundled/aws/SKILL.md
crates/openfang-skills/bundled/azure/SKILL.md
crates/openfang-skills/bundled/ci-cd/SKILL.md
crates/openfang-skills/bundled/code-reviewer/SKILL.md
crates/openfang-skills/bundled/compliance/SKILL.md
crates/openfang-skills/bundled/confluence/SKILL.md
crates/openfang-skills/bundled/crypto-expert/SKILL.md
crates/openfang-skills/bundled/css-expert/SKILL.md
crates/openfang-skills/bundled/data-analyst/SKILL.md
crates/openfang-skills/bundled/data-pipeline/SKILL.md
crates/openfang-skills/bundled/docker/SKILL.md
crates/openfang-skills/bundled/elasticsearch/SKILL.md
crates/openfang-skills/bundled/email-writer/SKILL.md
crates/openfang-skills/bundled/figma-expert/SKILL.md
crates/openfang-skills/bundled/gcp/SKILL.md
crates/openfang-skills/bundled/git-expert/SKILL.md
crates/openfang-skills/bundled/github/SKILL.md
crates/openfang-skills/bundled/golang-expert/SKILL.md
crates/openfang-skills/bundled/graphql-expert/SKILL.md
crates/openfang-skills/bundled/helm/SKILL.md
crates/openfang-skills/bundled/interview-prep/SKILL.md
crates/openfang-skills/bundled/jira/SKILL.md
crates/openfang-skills/bundled/kubernetes/SKILL.md
crates/openfang-skills/bundled/linear-tools/SKILL.md
crates/openfang-skills/bundled/linux-networking/SKILL.md
crates/openfang-skills/bundled/llm-finetuning/SKILL.md
crates/openfang-skills/bundled/ml-engineer/SKILL.md
crates/openfang-skills/bundled/mongodb/SKILL.md
crates/openfang-skills/bundled/nextjs-expert/SKILL.md
crates/openfang-skills/bundled/notion/SKILL.md
crates/openfang-skills/bundled/oauth-expert/SKILL.md
crates/openfang-skills/bundled/openapi-expert/SKILL.md
crates/openfang-skills/bundled/postgres-expert/SKILL.md
crates/openfang-skills/bundled/presentation/SKILL.md
crates/openfang-skills/bundled/project-manager/SKILL.md
crates/openfang-skills/bundled/prometheus/SKILL.md
crates/openfang-skills/bundled/prompt-engineer/SKILL.md
crates/openfang-skills/bundled/python-expert/SKILL.md

Metadata

Files
0
Version
acf2587
Hash
54942c40
Indexed
2026-08-20 07:39

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-21 20:29
浙ICP备14020137号-1 $mapa de visitantes$