Understanding Nginx: Core Concepts, Features, and Architecture

This article explains Nginx's role as a high‑performance HTTP and reverse‑proxy server, its event‑driven design that solves the C10K problem, key features, core modules, process model, request handling flow, and real‑world deployments across major websites.

Java Backend Technology
Java Backend Technology
Java Backend Technology
Understanding Nginx: Core Concepts, Features, and Architecture

1. Concept

Nginx (Engine X) is a free, open‑source, high‑performance HTTP server and reverse proxy, also an IMAP/POP3/SMTP proxy. It can host websites like Tomcat and handle HTTP requests, or act as a reverse proxy.

Nginx solves the C10K problem (handling 10,000 concurrent connections) using an event‑driven, asynchronous architecture instead of a thread‑per‑request model.

Although its market share is modest, its high performance and low memory usage make it popular; many sites such as WordPress and GitHub use Nginx as a reverse‑proxy load balancer.

2. Forward and Reverse Proxy

Forward proxy servers sit on the client side, forwarding client requests to external servers (e.g., GoAgent for bypassing firewalls).

Reverse proxy servers operate on the server side, receiving client requests and forwarding them to backend servers, then returning the responses. Nginx is a reverse proxy.

Clients must configure the forward proxy’s IP and port.

In reverse proxying, the client sees the proxy as the origin server and does not need special configuration; the proxy decides where to forward the request and returns the result.

3. Types of Servers

1) Web servers (e.g., Nginx, Apache, IIS) provide HTTP access. 2) Application servers run applications. 3) Proxy servers mediate client access. 4) Reverse proxies. 5) Backend servers. 6) CDN cache servers, which are reverse‑proxy based caching solutions for distant access.

4. Characteristics of Nginx

Cross‑platform: runs on most Unix‑like systems and has a Windows port.

Simple configuration.

Non‑blocking, high‑concurrency: official tests show 50k concurrent connections; production often sees 20‑30k.

No long‑lived connections between Nginx and backend servers.

Asynchronous request handling reduces backend load.

Simultaneous receiving from backend and sending to client.

Low network dependency; works with simple ping for load balancing.

Built‑in health checks based on status codes and timeouts.

Master/worker multi‑process model.

Low memory consumption, cost‑effective, bandwidth‑saving, high stability.

5. Basic Functions

Nginx offers core HTTP functions and extensible modules. Each module adds specific capabilities.

a) Serve static and index files, automatic indexing, and file descriptor caching. b) Cache‑accelerated reverse proxy and plain reverse proxy, simple load balancing and failover. c) Cache‑accelerated FastCGI with load balancing and failover. d) Modular filters such as gzip, byte‑ranges, chunked responses, and SSI.

Additional HTTP features include virtual hosting by name/IP, keep‑alive and pipelining, flexible configuration without downtime, customizable log formats, error‑code redirection, speed limiting, SSL/TLS SNI support, and IMAP/POP3/SMTP proxy capabilities.

6. Core Modules

The core consists of the CoreModule and EventsModule, plus third‑party HTTP modules. CoreModule controls basic server functions; EventsModule manages connection handling and impacts performance; HttpCoreModule provides essential HTTP access.

7. Internal Process Model

Nginx primarily uses a multi‑process model (with optional threading). After startup, a master process spawns multiple worker processes. The master manages workers, handles signals, and monitors their status. Workers share the listening sockets and independently accept and process client connections. The number of workers is typically set to the number of CPU cores.

8. Request Handling

On startup Nginx parses its configuration, creates listening sockets, and forks worker processes. When a client completes the TCP handshake, a worker accepts the connection, creates an ngx_connection_t structure, registers read/write event handlers, exchanges data, and finally closes the connection.

9. Real‑World Usage

Originally developed in Russia, Nginx has run on Rambler Media for three years and powers over 20% of Russian virtual‑hosting platforms. In China, major sites such as Taobao, Sina Blog, NetEase News, 56.com, Discuz!, and Douban use Nginx as a web server or reverse proxy.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Backend Developmentreverse proxyServer Architecture
Java Backend Technology
Written by

Java Backend Technology

Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.