The 'Other' Open Source Web Server
nginx: Open Source Web server with a small footprint and high load handling capability. If you thought Apache was the only viable open source Web server out there, you thought wrong. nginx boasts a lightweight footprint and high load handling capabilities.
From a distance it seems like there are no new Web servers under the sun. After all, in Internet time, Apache and Microsoft IIS have together cornered 85 percent of the market for generations. As the major players have grown in influence, they've also grown in other ways complexity and resource usage, to name two. In some contexts, administrators are turning to lightweight Web servers tuned to perform specific tasks with great efficiency.
Nginx, or "engineX," is the open source project of Russian developer Igor Sysoev. Although its footprint on the overall Web server market remains small, nginx is said to power more than 20 percent of Russian servers. According to the most recent Netcraft Web Server Surveys, nginx deployment doubled from 1 million to 2 million sites between May and June 2008 alone, making it the second most popular open source Web server behind Apache (admittedly, a long way behind).
The driving force behind nginx adoption is its efficient low-overhead HTTP and reverse proxy handling. As a Web server, nginx claims it can serve 50,000 simultaneous connections, and in contrast to Apache, it provides a clean and easily managed configuration file. The server itself can be upgraded while running to avoid downtime. In many cases, however, nginx is used as a load-balancing server to Web apps written in PHP and Ruby.
When used as a load-balancing reverse proxy server, nginx does not directly process page requests itself but instead hands off incoming requests to other servers downstream. Nginx can use load-balancing strategies like round robin and client IP to spread incoming requests across these workhorse servers, while at the same time providing a single public face with centralized processing of SSL and user authentication. A reverse proxy can cache and serve outgoing data elements to lighten the load of servers generating dynamic content.
Nginx comes with a mail proxy, which accepts and translates incoming HTTP requests into connections to POP3/IMAP/SMTP servers. This way, nginx can be used to power a Web-based front-end to conventional e-mail stores.
Binaries for nginx are available for several platforms, including RPM and DEB packages for Linux. However, for the most up-to-date version you'll need to download and compile the source. (A Windows binary with installer is currently up-to-date and available through another developer.) The software compiles easily, but it does require a few external libraries, like zlib, pcre and ssl. Consistent with its light footprint, the nginx source is only 500K and, once compiled, it consumes less than 2MB.
Like Apache, nginx is built around modules, which are added to nginx as needed so as not to run more functionality than necessary. There are not nearly as many modules for nginx as for Apache, however. Modules are available in access, authentication and rewrite, as well as gzip compression, flash video streaming and FastCGI for accelerated execution of PHP and other server-side languages.
Support for deploying nginx revolves almost entirely around the nginx English wiki (the original documentation is in Russian). Fortunately, the wiki is very good and includes "recipes" for a wide variety of server configurations, from PHP and Python Web app servers to load balancing and POP3 proxies.
Clearly, nginx is not a point-and-click Web server, nor is it meant to be. If you have hands-on experience tuning your server farm and are looking to benefit from replacing resource-heavy public-facing servers with a fast and lightweight alternative, the emerging nginx server is a clean, elegant and robust choice.
Pros: Low resource use; Elegant configuration file; Practical support wiki.
Cons: Not for the inexperienced web admin; No visual interface; Small support community.
Reviewed by: Aaron Weiss
Original Review Date: 07/07/2008
Original Review Version: 0.7.6