Free Sample
+ Collection
Code Files

Mastering Nginx

Dimitri Aivaliotis

Written for experienced systems administrators and engineers, this book teaches you from scratch how to configure Nginx for any situation. Step-by-step instructions and real-world code snippets clarify even the most complex areas.
RRP $26.99
RRP $44.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849517447
Paperback322 pages

About This Book

  • An in-depth configuration guide to help you understand how to best configure NGINX for any situation
  • Includes useful code samples to help you integrate NGINX into your application architecture
  • Full of example configuration snippets, best-practice descriptions, and reference tables for each directive


Who This Book Is For

If you are an experienced systems administrator or systems engineer, familiar with installing and configuring servers to meet specific needs and want to master NGINX, then this book is for you. You do not need to have experience using NGINX already.

Table of Contents

Chapter 1: Installing NGINX and Third-Party Modules
Installing NGINX using a package manager
Installing NGINX from source
Configuring for web or mail service
Enabling various modules
Finding and installing third-party modules
Putting it all together
Chapter 2: A Configuration Guide
The basic configuration format
NGINX global configuration parameters
Using include files
The HTTP server section
The virtual server section
Locations – where, when, and how
The mail server section
Full sample configuration
Chapter 3: Using the Mail Module
Basic proxy service
Authentication service
Combining with memcached
Interpreting log files
Operating system limits
Chapter 4: NGINX as a Reverse Proxy
Introduction to reverse proxying
Types of upstream servers
Converting an "if"-fy configuration to a more modern interpretation
Using error documents to handle upstream problems
Determining the client's real IP address
Chapter 5: Reverse Proxy Advanced Topics
Security through separation
Isolating application components for scalability
Reverse proxy performance tuning
Chapter 6: The NGINX HTTP Server
NGINX's architecture
The HTTP core module
Using limits to prevent abuse
Restricting access
Streaming media files
Predefined variables
Using NGINX with PHP-FPM
Wiring NGINX and uWSGI together
Chapter 7: NGINX for the Developer
Caching integration
Changing content on-the-fly
Using Server Side Includes
Decision-making in NGINX
Creating a secure link
Generating images
Tracking website visitors
Preventing inadvertent code execution
Chapter 8: Troubleshooting Techniques
Analyzing log files
Configuring advanced logging
Common configuration errors
Operating system limits
Performance problems
Using the Stub Status module

What You Will Learn

  • Compile the right third party module to meet your needs
  • Write an authentication server to use with the mail proxy module
  • Create your own SSL certificates to encrypt connections
  • Use try_files to solve your file-existence check problems
  • Cache and compress responses for speedier user-interaction
  • Integrate popular PHP frameworks with the FastCGI module
  • Construct useful logging configurations
  • Troubleshoot configuration problems as they arise


In Detail

NGINX is a high-performance HTTP server and mail proxy designed to use very few system resources. With the many tutorials and example configurations floating around the Web, it is difficult to know how to properly configure NGINX to meet your expectations.

"Mastering Nginx" will serve to clarify the murky waters of NGINX configuration, helping you learn how to tune NGINX for various situations, what some of the more obscure configuration directives do, and how to design a decent configuration to match your needs.

Beginning with an overview of compiling NGINX and describing its basic configuration file format, this guide next takes you on a tour of NGINX's modules.

From the unique mail module to the upstream module, this book explores the various possibilities of using NGINX as a reverse proxy. The multiple HTTP modules are explained, and the book rounds off the tour with a discussion of troubleshooting.

"Mastering Nginx" will explain all aspects of configuring NGINX to help solve your hosting problems.


Read More