Nginx is an http server intended for high traffic websites with a mind toward network scalability. I used NGINX as my primary web server for about 3 years. At the time, I hosted my sites on under-powered hardware that had little memory and had trouble keeping up with demand when I used Apache, but was able to keep this web site up and running the day one of my posts hit the front page of Digg (back when dinosaurs roamed the Earth and Digg was a really cool website). Back then, NGINX was still pretty new and most of the documentation was either in Russian, sporadic, or consisted of random posts on people’s blogs. It has been a couple of years since I upgraded my server to something beefier. At that time, I switched back to Apache, since I have used it for years and know it very well. That could change again, especially now that the official documentation for NGINX is much better, and because of today’s review book.
Mastering NGINX is by Dimitri Aivaliotis, a systems architect for a hosting provider and someone who uses NGINX daily. His experience shows in the quality and depth of the material. Unlike a different book on NGINX from the same publisher that I reviewed in 2010, Nginx HTTP Server, this book is well written and does not suffer from what I have come to call “The Packt Problem.” I hope this is a sign that Packt’s copy editing process has improved and that there is now a stronger commitment to offer titles that are worthy of being read because of the quality of the writing as well as the quality and uniqueness of the technical content.
Mastering NGINX is intended for experienced systems administrators and systems engineers, people who are familiar with using and administering *nix machines and configuring servers. This is not a beginner book. For me, that is a plus. It allows the author to get right down to business with NGINX.
We start with a short and typical installation chapter, complete with a discussion of modules that includes third-party modules and their benefits and risks. Installing using the package managers of several types of Linux distributions is covered along with compiling from source and the various flags and configure options available.
The next chapter jumps right in to the good stuff. Most of the NGINX materials I once used tell you what to change, but not why to change it. For a long time I was left wondering how to tell when to use specific configuration options, which files to find them in, and what the parameters are that I can use. The goal of this book is not to tell you what to do, but to describe these very things, so that in the end, you should be able to find and open an NGINX configuration file and edit it to fit your situation. Well done.
I was a little concerned when I realized that I was nearing the end of the chapter and still had some questions in my mind about some of the parameters and settings. Then I read this on page 40 in the chapter summary:
What we did not cover in this chapter are the configuration options provided by the various modules that may be compiled into your
nginxbinary. These additional directives will be touched upon through the book, as that particular module is used to solve a problem. Also absent was an explanation of the variables that NGINX makes available for its configuration. These too will be discussed later in this book. This chapter’s focus was on the basics of configuring NGINX.
Bravo! The author was thinking ahead, anticipated my concerns, and addressed them immediately at the point I had them.
The rest of the book gives deeper, more detailed information about specific uses for NGINX. Topics covered include using NGINX for serving mail, reverse proxying, setting up security, HTTP serving, including setting up your server for use with PHP (which is much easier now than when I wrote this outdated post), caching, tracking, and various sorts of troubleshooting. I was thrilled to see the appendices, especially the rewrite rule guide, as when I tried to do rewrites, I couldn’t find any good information (see my now-long-outdated post on the topic.
I was pleased to see how complete and clear the book is. Kudos to the author, the reviewers and editors, and the publisher. I recommend this book to anyone who uses NGINX or wants to do so.
Disclosure: I was given my copy of this book by the publisher as a review copy.