Book Review: Nginx HTTP Server

Disclaimer

I have to admit up front that I know the author of this book and originally introduced him to Nginx, that said, the friendship between us will not affect this review.

Conclusion

I always skip to this part when I read reviews, so I figure I might as well start with it, the details will follow after the conclusion.

Nginx HTTP Server is a new book by Clément Nedelcu and published by Packt Publishing, it’s the first English book about Nginx to be available for purchase. Previously users had to depend on the wiki and various blogs for documentation; before that IRC and the mailing list. All aspects of Nginx have undergone huge growth, from the feature set to the user base and finally to the documentation. This book fills an important area in Nginx documentation that has been missing, a hard copy of coherent logical steps that documents the Nginx HTTP server. The wiki is a great source of information, but it’s difficult to print out easily readable material to bring on the train or bus to work, or even if you just want to sit down with a cup of tea and read.

More >

File Uploading With PHP & Nginx

Performance is often important to people using Nginx – and for good reason, of course. Sadly, while many people will optimize their software stack they will rarely work on optimizing the back-end code; and even more rarely will they eliminate single points of failure. Such was also the case when SitePoint recently published an article about uploading large files with PHP. This post will discuss a method to accept uploads that will scale far better and not offer malicious users an easy DoS vector.

More >

Nginx Primer

Nginx is a fairly simple HTTP server, though there are a few gotchas people need to be aware of before they start using this 8th wonder. The most important is that Nginx is a reverse proxy first and HTTP server second, it does not necessarily have a concept of file, this will change the way we handle our configuration a bit.

The first thing you need to know is that the Nginx configuration file is an inheriting-hierarchy, directives specified in a higher block will filter down to lower blocks as a default value, from this follows that we want to specify things in the top most hierarchy whenever possible. Since directives in top blocks filter down as default values it is still possible to override them in most cases.

There are 3 hierarchies which are usually referred to as blocks. The HTTP-block, the server-block and the location block of which the hierarchy goes like this: http -> server -> location.

Furthermore there are two special locations, an event block and the root which the event block and the http block reside in. Both of these contain only a minor amount of directives. The majority of your time will be spent in the other three blocks.

The blocks have a semantic meaning of sorts. The server block is what in Apache would be considered a virtual host. The location block usually referrers to the URI.

When using the official wiki the context keyword specifies in which block a directive may be used, as mentioned earlier it is usually recommended to specify the directive in the top most block.

More >