nginx
Nginx configuration expert for reverse proxy, load balancing, TLS, and performance tuning
What this skill does
# 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
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.