NGINX चीटशीट
NGINX कॉन्फ़िगरेशन डायरेक्टिव और CLI संचालन: सर्वर ब्लॉक, रिवर्स प्रॉक्सी हेडर, WebSockets, TLS, कैशिंग, कम्प्रेशन और रेट लिमिटिंग।
यह कैसे काम करता है
NGINX resolves `server { listen; server_name; }` first, then picks the most specific `location` block, forwarding or serving static files; always validate with `nginx -t` before `reload`.
सर्वाइवल किट
वे कुछ कमांड जिन्हें सबसे पहले सीखना चाहिए।
40 कमांड
CLI Check, Reload & Logs
Validate syntax, reload without dropping connections, and inspect runtime config.
- आवश्यक
Test all included nginx configuration files for syntax and path errors
nginx -tइसका उपयोग कब करें
Never reload NGINX without testing first; broken config aborts reload safely only if checked.
घटक विवरण
- -t
- Parse config and test validity without applying
उदाहरण
sudo nginx -tपरिणाम
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Server Blocks, Locations & Static Files
Understand location matching precedence, SPA fallbacks, and clean redirects.
Reverse Proxy, Upstreams & WebSockets
Forward client IPs, HTTP/1.1 keepalives, WebSocket upgrades, and timeouts.
TLS, Security Headers & Rate Limits
Enforce HTTPS, TLS 1.2/1.3, security headers, and per-IP rate/size caps.
Compression, Caching & Tuning
Enable gzip, cache-control headers, worker limits, and proxy microcaching.