Skills nginx
install
source · Clone the upstream repo
git clone https://github.com/TerminalSkills/skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/TerminalSkills/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/nginx" ~/.claude/skills/terminalskills-skills-nginx && rm -rf "$T"
manifest:
skills/nginx/SKILL.mdsource content
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
for domain matching andserver_name
for ports, using separate blocks for HTTP (port 80, redirect to HTTPS) and HTTPS (port 443 with SSL and HTTP/2).listen - When setting up reverse proxying, use
to forward to upstream servers and setproxy_pass
for Host, X-Real-IP, X-Forwarded-For, and X-Forwarded-Proto to preserve client information.proxy_set_header - When load balancing, define
blocks with multiple servers and choose the strategy: round-robin (default),upstream
,least_conn
for sticky sessions, or weighted distribution.ip_hash - When configuring TLS, set modern protocols (
), enableTLSv1.2 TLSv1.3
and session caching, and integrate with Let's Encrypt via certbot for automatic certificate renewal.ssl_stapling - When serving static files, enable
compression for text-based content, setgzip
for hashed assets, useexpires 1y
for efficient transfer, andsendfile on
for SPA fallback routing.try_files - When adding security, set headers (X-Frame-Options, X-Content-Type-Options, HSTS, CSP) and configure rate limiting with
to prevent abuse.limit_req_zone
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
with proper header forwardingproxy_pass http://localhost:3000 - 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
block with three backend servers andupstream
strategyleast_conn - Set
for automatic health checkingmax_fails=3 fail_timeout=30s - Add a
server that activates only when primary servers are downbackup - 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
with specific domains; avoid theserver_name
catch-all in production for security._ - Always redirect HTTP to HTTPS with
on the port 80 block.return 301 https://$host$request_uri - Set security headers on every server block using an included snippet file for consistency.
- Use
for SPA routing instead oftry_files
since it is faster and more explicit.rewrite - Rate-limit API endpoints with
to prevent abuse without affecting normal traffic.limit_req zone=api burst=20 nodelay - Cache static assets aggressively:
for hashed filenames andexpires 1y
for HTML.expires 1h - Always test config before reload:
to prevent downtime from syntax errors.nginx -t && nginx -s reload