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;
🧠 Проверка знаний
🧒 Простыми словами
Представьте очень быстрого официанта в ресторане. Nginx — это тот официант для интернета. Он принимает заказы (запросы) от клиентов (пользователей) и мгновенно приносит еду (страницы) или передает заказы поварам (серверам).
🤓 Expert Deep Dive
Nginx использует модель master-worker. Главный процесс читает конфигурацию, а рабочие процессы обрабатывают запросы, используя неблокирующий ввод-вывод (epoll). Он отлично справляется с терминацией SSL/TLS и перезаписью URL.