Nginx: high-performance web server and reverse proxy. Lightweight, efficient, fast. Used for: web server (serve static files), reverse proxy (forward requests to backend servers), load balancer (distribute traffic), API gateway. Benefits: handles thousands of concurrent connections, low memory footprint, simple configuration. Popular for microservices and high-traffic applications.
Reverse proxy: forward client requests to backend servers. nginx.conf: upstream backend { server backend1:3000; server backend2:3000; }. location / { proxy_pass http://backend; }. Load balancing: distribute requests. Health checks: skip unhealthy servers. Caching: improve performance. SSL termination: handle HTTPS.
Load balancing algorithms in Nginx: Round robin (default), least_conn, ip_hash, random. Configuration: upstream backend { server srv1; server srv2; server srv3 weight=5; }. weight: priority. Sticky sessions: ip_hash maintains session. Health checks: passive (detect failures), active (probe servers). Monitor with nginx -s reload for graceful reload.