The Origin of Nginx, Its Use Cases, Proxy Types, and Load‑Balancing Algorithms
This article explains how Nginx was created to overcome Apache's limitations, describes its role as a high‑performance HTTP and reverse‑proxy server, clarifies forward and reverse proxy concepts, outlines common deployment scenarios, compares load‑balancing algorithms, and provides a feature comparison with other web servers.
Nginx's Origin
If you have heard of Apache, you have also likely heard of its counterpart Nginx, a lightweight, high‑concurrency web server. Apache, while stable and cross‑platform, was designed for an era with limited bandwidth and hardware, leading to high memory consumption and CPU overhead under massive concurrent connections.
To address these shortcomings, Russian engineer Igor Sysoev wrote Nginx in C while working at Rambler Media, initially to serve Rambler’s own traffic. He later released the source code under a free software license.
Nginx gained popularity because it uses an event‑driven architecture that can handle millions of TCP connections, offers modular extensibility, runs on many operating systems (Linux, Windows, FreeBSD, Solaris, AIX, macOS), and provides great stability.
Nginx's Use Cases
Nginx is a free, open‑source, high‑performance HTTP server and reverse‑proxy server; it also supports IMAP, POP3, and SMTP proxying. It can serve static websites, act as a reverse proxy for load balancing, and function as an email proxy.
About Proxy
A proxy acts as an intermediary between a client and a target server. In a forward proxy, the client configures the proxy’s IP and port; the proxy forwards the request to the target server and returns the response, hiding the client’s identity.
In a reverse proxy, the proxy sits in front of one or more backend servers. Clients are unaware of the proxy; the proxy distributes incoming requests among the backend servers, providing load balancing and hiding server details.
Clients must configure a forward proxy with its IP address and port.
Forward Proxy
Used to access resources that are otherwise unreachable (e.g., Google), to cache content, to enforce client authentication, or to record user activity.
Reverse Proxy
Commonly used in large‑scale sites such as Taobao, where Nginx distributes requests to many backend servers, improving scalability and security. The proxy is transparent to clients.
Project Scenarios
In practice, forward and reverse proxies often coexist: a forward proxy forwards client requests to a reverse‑proxy server, which then balances the load across multiple backend services.
Load Balancing
Nginx, acting as a reverse proxy, distributes incoming requests according to configurable algorithms. Common algorithms include:
Weight round‑robin (default): Requests are assigned sequentially; servers can be given a weight to receive a larger share of traffic.
ip_hash: Requests from the same client IP are consistently routed to the same backend, helping with session persistence.
fair: Dynamically balances based on each server’s response time (requires the upstream_fair module).
url_hash: Routes based on a hash of the request URL, improving cache efficiency (requires additional module).
Comparison of Common Web Servers
Feature
Apache
Nginx
Lighttpd
Proxy
Very good
Very good
Average
Rewriter
Good
Very good
Average
Fcgi
Poor
Good
Very good
Hot deployment
Not supported
Supported
Not supported
System load
High
Low
Relatively low
Stability
Good
Very good
Poor
Security
Good
Average
Average
Static file handling
Average
Very good
Good
Reverse proxy
Average
Very good
Average
(End)
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java Captain
Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
