It is a well-known fact that the web server market has a long-established leader: Apache. According to recent surveys, as of October 2015, almost 35 percent of the World Wide Web is served by this 20-year-old open source application. However, for the past few years, the same reports reveal the rise of a new competitor: Nginx, a lightweight HTTP server originating from Russia—pronounced engine X. There have been many questions surrounding this young web server. What is the reason causing so many server administrators to switch to Nginx since the beginning of year 2009? Is this tiny piece of software mature enough to run my high-traffic website? To begin with, Nginx is not as young as one might think. Originally started in 2002, the project was first carried out by a standalone developer, Igor Sysoev, for the needs of an extremely high-traffic Russian website, namely Rambler, which received as of September 2008 over 500 million HTTP requests per day. The application is now used to serve some of the most popular websites on the web, such as Reddit, Wikipedia, WordPress, Dropbox, and many more. Nginx has proven to be a very efficient, lightweight yet powerful web server. Throughout this book, you will discover many features of Nginx and progressively understand why so many administrators have decided to place their trust in this new HTTP server, often at the expense of Apache.
There are many aspects in which Nginx is more efficient than its competitors, first and foremost, speed: making use of asynchronous sockets, Nginx does not spawn processes as many times as it receives requests. One process per core suffices to handle thousands of connections, allowing a much lighter CPU load and memory consumption. Second, ease of use: configuration files are much simpler to read and tweak than with other web server solutions, such as Apache. A couple of lines are enough to set up a complete virtual host configuration. Last but not least, modularity: not only is Nginx a completely open source project released under a BSD-like license, but it also comes with a powerful plug-in system—referred to as modules. A large variety of modules are included with the original distribution archive, and many third-party ones can be downloaded online. All in all, Nginx combines speed, efficiency, and power, providing you the perfect ingredients for a successful web server; it appears to be the best Apache alternative as of today.