> nginx
Assists with configuring Nginx as a web server, reverse proxy, and load balancer. Use when serving static files, proxying to application servers, setting up TLS termination, configuring caching, rate limiting, or writing security headers. Trigger words: nginx, reverse proxy, load balancer, tls, ssl, server block, location block.
curl "https://skillshub.wtf/TerminalSkills/skills/nginx?format=md"Nginx
Overview
Nginx is a high-performance web server and reverse proxy that serves static files, proxies requests to application servers, load balances across backends, terminates TLS, and caches responses. It handles thousands of concurrent connections with minimal resource usage through an event-driven, non-blocking architecture.
Instructions
- When configuring server blocks, define virtual hosts with
server_namefor domain matching andlistenfor ports, using separate blocks for HTTP (port 80, redirect to HTTPS) and HTTPS (port 443 with SSL and HTTP/2). - When setting up reverse proxying, use
proxy_passto forward to upstream servers and setproxy_set_headerfor Host, X-Real-IP, X-Forwarded-For, and X-Forwarded-Proto to preserve client information. - When load balancing, define
upstreamblocks with multiple servers and choose the strategy: round-robin (default),least_conn,ip_hashfor sticky sessions, or weighted distribution. - When configuring TLS, set modern protocols (
TLSv1.2 TLSv1.3), enablessl_staplingand session caching, and integrate with Let's Encrypt via certbot for automatic certificate renewal. - When serving static files, enable
gzipcompression for text-based content, setexpires 1yfor hashed assets, usesendfile onfor efficient transfer, andtry_filesfor SPA fallback routing. - When adding security, set headers (X-Frame-Options, X-Content-Type-Options, HSTS, CSP) and configure rate limiting with
limit_req_zoneto prevent abuse.
Examples
Example 1: Set up Nginx as reverse proxy with TLS for a Node.js app
User request: "Configure Nginx with HTTPS to proxy to my Node.js API on port 3000"
Actions:
- Create a server block listening on port 443 with SSL certificate paths and HTTP/2
- Configure
proxy_pass http://localhost:3000with proper header forwarding - Add a port 80 server block that redirects all HTTP to HTTPS
- Enable ssl_stapling, session caching, and modern cipher suites
Output: An Nginx configuration with TLS termination, HTTP-to-HTTPS redirect, and reverse proxy to the Node.js app.
Example 2: Configure load balancing with health checks
User request: "Load balance across three API servers with failover"
Actions:
- Define an
upstreamblock with three backend servers andleast_connstrategy - Set
max_fails=3 fail_timeout=30sfor automatic health checking - Add a
backupserver that activates only when primary servers are down - Configure proxy caching for GET requests to reduce backend load
Output: A load-balanced setup with automatic failover, health checks, and response caching.
Guidelines
- Use
server_namewith specific domains; avoid the_catch-all in production for security. - Always redirect HTTP to HTTPS with
return 301 https://$host$request_urion the port 80 block. - Set security headers on every server block using an included snippet file for consistency.
- Use
try_filesfor SPA routing instead ofrewritesince it is faster and more explicit. - Rate-limit API endpoints with
limit_req zone=api burst=20 nodelayto prevent abuse without affecting normal traffic. - Cache static assets aggressively:
expires 1yfor hashed filenames andexpires 1hfor HTML. - Always test config before reload:
nginx -t && nginx -s reloadto prevent downtime from syntax errors.
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> xero-accounting
Integrate with the Xero accounting API to sync invoices, expenses, bank transactions, and contacts — and generate financial reports like P&L and balance sheet. Use when: connecting apps to Xero, automating bookkeeping workflows, syncing accounting data, or pulling financial reports programmatically.
> windsurf-rules
Configure Windsurf AI coding assistant with .windsurfrules and workspace rules. Use when: customizing Windsurf for a project, setting AI coding standards, creating team-shared Windsurf configurations, or tuning Cascade AI behavior.