Nginx reverse proxy and load balancing

7758
0

Nginx serves as a high-performance reverse proxy and load balancer. The upstream block defines backend server pools. Load balancing methods include round-robin (default), least_conn, ip_hash, and random. The proxy_pass directive forwards requests to upstreams. proxy_set_header passes client information like X-Real-IP and X-Forwarded-For. SSL termination with ssl_certificate and ssl_certificate_key handles HTTPS. server_name enables virtual hosting. Rate limiting with limit_req_zone prevents abuse. Gzip compression reduces bandwidth with gzip on. Caching with proxy_cache stores upstream responses. location blocks match URL patterns for routing. Security headers like X-Frame-Options and Content-Security-Policy harden the server.