Nginx

Hochleistungs-Webserver und Reverse-Proxy.

Inhalt steht zur Übersetzung an. Die englische Version wird angezeigt.

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;

      

🧠 Wissenstest

1 / 1

🧒 Erkläre es wie einem 5-Jährigen

Nginx is like the world's most efficient traffic cop and receptionist in front of a busy restaurant. It greets customers (users), serves the quick orders (static files) immediately, and directs the complex orders ([API](/de/terms/api) calls) to the right chefs (backend servers) without breaking a sweat.

🤓 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](/de/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.

📚 Quellen