Nginx

Nginx is a high-performance, open-source web server and reverse proxy that excels at handling concurrent connections efficiently, making it a popular choice for...

Nginx (pronounced "engine-x") is a high-performance, open-source web server that can also be used as a reverse proxy, load balancer, mail proxy, and HTTP cache. Its architecture is event-driven and asynchronous, employing a master process and multiple worker processes. The master process manages the worker processes, handling configuration reloads and graceful shutdowns. Worker processes, typically one per CPU core, efficiently handle client connections using a non-blocking, I/O multiplexing approach (e.g., epoll on Linux). This design allows Nginx to handle tens of thousands of concurrent connections with minimal memory footprint and CPU usage, making it exceptionally scalable and performant. Nginx excels at serving static content directly and efficiently, but its reverse proxy capabilities are equally powerful. It can distribute incoming traffic across multiple backend servers, perform health checks on those servers, and cache responses to reduce load. Its configuration language is declarative and hierarchical, allowing for fine-grained control over routing, security (SSL/TLS termination), caching rules, and request manipulation. Trade-offs include a less flexible module system compared to some competitors and a steeper learning curve for complex configurations, though its core functionality is straightforward.

        graph LR
  Center["Nginx"]:::main
  Rel_redis["redis"]:::related -.-> Center
  click Rel_redis "/terms/redis"
  Rel_reverse_proxy["reverse-proxy"]:::related -.-> Center
  click Rel_reverse_proxy "/terms/reverse-proxy"
  classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
  classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
  classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
  classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
  linkStyle default stroke:#4b5563,stroke-width:2px;

      

🧠 Prueba de conocimiento

1 / 1

🧒 Explícalo como si tuviera 5 años

Nginx is like a super-fast traffic director for websites. It quickly sends visitors to the right place and can handle tons of visitors at once without getting overwhelmed.

🤓 Expert Deep Dive

The Nginx event-driven, asynchronous architecture is key to its performance. It utilizes a small number of worker processes that continuously monitor listening sockets. Upon receiving a connection, a worker process handles it through a state machine, performing non-blocking I/O operations. This avoids the thread-per-connection overhead common in traditional servers. Its reverse proxy functionality involves accepting client requests, forwarding them to upstream servers, receiving responses, and sending them back to the client, often with features like SSL termination, HTTP compression, and request/response modification via modules (ngx_http_proxy_module, ngx_http_ssl_module). Load balancing algorithms (round-robin, least-connected, IP hash) are built-in. Caching (ngx_http_proxy_module with proxy_cache) further enhances performance by storing frequently accessed content. Architectural trade-offs involve its primarily C-based core, making deep customization complex, and its event [loop](/es/terms/event-loop) model, which can be less efficient for CPU-bound tasks compared to threaded models. Vulnerabilities often stem from misconfigurations or exploits in specific modules.

📚 Fuentes