Book review: Nginx HTTP Server

Packt Publishing has provided me with a copy of their new book, Nginx HTTP Server (this URL contains a tracking code for Packt to monitor their marketing efforts) by Clément Nedelcu, kindly asking me to review it. They sent me a PDF version of the book, which is litte more than 305 pages in length.

You might be aware that Nginx is a very fast and lightweight server developed by Igor Sisoyev, originally for the Russian portal site rambler.ru, and released under the BSD license. Nginx shines for rapidly serving static files an serving as a frontend for other servers.

This book, the first English language book about Nginx, is aimed squarely at  beginners: either people migrating from a more traditional Apache/*nix setup, or even those totally new to *nix, as the first chapter is a brief introduction to the Unix/Linux command line. The book then covers basic Nginx configuration (including virtual hosts), and then running Nginx in tandem with Fastcgi and as a frontend for Apache. As is often the case, the configuration reference contains a lot of material which is almost identical to wiki.nginx.org, so it will mostly appeal to those who are allergic to perpetually loading the documentation in the browser.

The chapters on running Nginx with Fastcgi and as a reverse proxy for Apache are more interesting, as they collect in one place a lot of information which is scattered all over the web. For those new to Fastcgi, there is a very accessible explanation of how the standard evolved from CGI, and how the Fastcgi process communicates with the server. The section on Fastcgi is focused on PHP, also there is chapter on running Django with Flup. Personally, I would not use Flup to run Django, and would prefer Apache with ModWSGI or a dedicated WSGI server.

This brings us to the next chapter. Here the focus is on using Nginx as a reverse proxy in front of Apache, but much would apply if instead of Apache you had any other HTTP server, including Tin (for Rails) or Gunicorn (for Python). Again, the information is very basic, but it will no doubt get you started on the right track. There are also a few lines about using multiple backend servers and round-robin configurations, but the subject does not receive a very in depth treatment.

The last chapter might prove the most popular. It contains instructions for migrating from Apache to Nginx, including detailed translations of the mod_rewrite rules for popular PHP applications such as WordPress and Mediawiki into the Nginx rewrite syntax. It also explains how .htaccess files work in Apache and how to replace them with Nginx.

The book is well written, the explanations are clear and correct, and the reader is mercifully spared the amount of superfluous jokes which plague too many technical books. If you want to give Nginx a try, maybe for saving some RAM on your VPS, and you haven’t got the faintest idea of where to start, this book might be a good choice. Another reason to buy the book would be to use the ready made recipes for running Nginx with popular applications.

Nevertheless, I must confess to be a bit puzzled by Packt’s decision to produce such an introductory book, as I would imagine that people who have heard of Nginx are already quite savvy, and probably expect more advanced information to justify the expense.

If you want to know more about Nginx HTTP Server from Packt Publishing, I may be able to have a short email interview with the author in the coming days.