NGINX Full Version

使用 NGINX 和 NGINX Plus 作为 Web 服务器

2019 update: NGINX has now passed Apache to become the most popular web server for the top 1,000, 10,000, 100,000, and 1 million busiest websites in the world. Why is NGINX seeing such wide and increasing adoption and why should you consider using NGINX or NGINX Plus as your web server?

Why NGINX?

NGINX is much more than just a web server. Traditionally, the web server and the application delivery controller (ADC) or reverse‑proxy load balancer have been deployed as separate components of a web application delivery solution. But creating a scalable and high‑performance web server or ADC requires many of the same techniques. In many environments, one reason to deploy an ADC is to mitigate performance problems with the web server. By combining the ADC and web server into a single tool, NGINX is a really a new type of product for web application delivery, providing performance and scalability at both the ADC and web server layers.

Handling Concurrent Connections

One of the major reasons that people replace their Apache web server with NGINX is to get improved performance. Performance has many aspects, but one of the important areas where NGINX shines is in handling large numbers of concurrent connections.

It’s a challenge to deal with many HTTP clients that each open many connections, and with the latency and other delays involved. Apache’s model of using a thread or process per connection causes high overhead for each connection, which limits the number of connections it can handle. NGINX uses a far more efficient model where a small number of processes can each handle a very large number of connections. This architecture allows a single server to handle a far larger number of clients.

WebFaction ran tests to compare how NGINX and Apache performed when handling different numbers of concurrent connections. First, the results for requests per second:

And memory usage:

As these results indicate, NGINX both performs better and uses less memory than Apache at every level of concurrency. That means that you need a smaller number of NGINX servers to process the same load, with all the benefits that come with that.

Serving Static and Dynamic Content

Another reason users are replacing Apache HTTP Server with NGINX is to adopt a new model for delivering applications made possible by NGINX. NGINX can deliver static content locally, but for dynamic content it acts as proxy in front of other servers that deliver the dynamic application content, thus keeping NGINX lean and leaving the generation of dynamic content to servers that specialize in it, such as FastCGI‑ or uwsgi‑based servers, application servers such as WebSphere, JBoss, and Tomcat, or even other web servers such as Apache.

Much More than Just a Web Server

As we said earlier, NGINX is more than just a high‑performance web server; it is loaded with features. Here are just some of them:

For more information on configuring NGINX and NGINX Plus as a web server, check out the NGINX Plus Admin Guide. For information about the full range of functionality that NGINX Plus provides, visit us at nginx.com.