Mastering Nginx

Mastering Nginx
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • 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


Book Details

Language : English
Paperback : 322 pages [ 235mm x 191mm ]
Release Date : March 2013
ISBN : 1849517444
ISBN 13 : 9781849517447
Author(s) : Dimitri Aivaliotis
Topics and Technologies : All Books, Networking and Servers, Linux Servers, Open Source

Table of Contents

Chapter 1: Installing NGINX and Third-Party Modules
Chapter 2: A Configuration Guide
Chapter 3: Using the Mail Module
Chapter 4: NGINX as a Reverse Proxy
Chapter 5: Reverse Proxy Advanced Topics
Chapter 6: The NGINX HTTP Server
Chapter 7: NGINX for the Developer
Chapter 8: Troubleshooting Techniques
Appendix A: Directive Reference
Appendix B: Rewrite Rule Guide
Appendix C: The NGINX Community
Appendix D: Persisting Solaris Network Tunings
  • Chapter 1: Installing NGINX and Third-Party Modules
    • Installing NGINX using a package manager
      • CentOS
      • Debian
    • Installing NGINX from source
      • Preparing a build environment
      • Compiling from source
        • Table: Common configure options
        • Table: Configure options for optimization
    • Configuring for web or mail service
      • Configure options for a mail proxy
        • Table: Mail configure options
      • Configure the options to specify paths
        • Table: HTTP configure options
    • Enabling various modules
      • Table: HTTP module configure options
    • Disabling unused modules
      • Table: Disable configure options
  • Finding and installing third-party modules
  • Putting it all together
  • Summary
    • Using include files
    • The HTTP server section
      • Client directives
        • Table: HTTP client directives
      • File I/O directives
        • Table: HTTP file I/O directives
      • Hash directives
        • Table: HTTP hash directives
      • Socket directives
        • Table: HTTP socket directives
      • Sample configuration
    • The virtual server section
      • Table: listen parameters
    • Locations – where, when, and how
      • Table: Location modifiers
      • Table: Location-only directives
    • The mail server section
      • Table: Mail module directives
      • Table: Mail SSL directives
    • Full sample configuration
    • Summary
      • Chapter 3: Using the Mail Module
        • Basic proxy service
          • POP3 service
          • IMAP service
          • SMTP service
          • Using SSL/TLS
          • Complete mail example
        • Authentication service
        • Combining with memcached
        • Interpreting log files
        • Operating system limits
        • Summary
        • Chapter 4: NGINX as a Reverse Proxy
          • Introduction to reverse proxying
            • The proxy module
              • Table: Proxy module directives
              • Legacy servers with cookies
            • The upstream module
              • Table: Upstream module directives
              • Keepalive connections
              • Load-balancing algorithms
          • Types of upstream servers
            • Single upstream server
            • Multiple upstream servers
            • Non-HTTP upstream servers
              • Memcached upstream servers
              • FastCGI upstream servers
              • SCGI upstream servers
              • uWSGI 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
          • Summary
          • Chapter 5: Reverse Proxy Advanced Topics
            • Security through separation
              • Encrypting traffic with SSL
              • Authenticating clients using SSL
              • Blocking traffic based on originating IP address
            • Isolating application components for scalability
            • Reverse proxy performance tuning
              • Buffering
                • Table: Proxy module buffering directives
              • Caching
                • Table: Proxy module caching directives
                • Storing
              • Compressing
                • Table: Gzip module directives
            • Summary
            • Chapter 6: The NGINX HTTP Server
              • NGINX's architecture
              • The HTTP core module
                • The server
                  • Table: HTTP server directives
                • Logging
                  • Table: HTTP logging directives
                  • Table: Log format variables
                • Finding files
                  • Table: HTTP file-path directives
                • Name resolution
                  • Table: Name resolution directives
                • Client interaction
                  • Table: HTTP client interaction directives
              • Using limits to prevent abuse
                • Table: HTTP limits directives
            • Restricting access
              • Table: HTTP access module directives
            • Streaming media files
              • Table: HTTP streaming directives
            • Predefined variables
              • Table: HTTP variables
            • Using NGINX with PHP-FPM
              • Table: FastCGI directives
            • An example Drupal configuration
            • Wiring NGINX and uWSGI together
              • An example Django configuration
            • Summary
              • Chapter 7: NGINX for the Developer
                • Caching integration
                  • No application caching
                  • Caching in the database
                    • Table: Memcached module directives
                  • Caching in the filesystem
                    • Table: Header modifying directives
                • Changing content on-the-fly
                  • The addition module
                    • Table: HTTP addition module directives
                  • The sub module
                    • Table: HTTP sub module directives
                  • The xslt module
                    • Table: HTTP XSLT module directives
                • Using Server Side Includes
                  • Table: Server Side Includes directives
                  • Table: Server Side Includes commands
              • Decision-making in NGINX
                • Table: Perl module directives
              • Creating a secure link
              • Generating images
                • Table: Image filter directives
              • Tracking website visitors
                • Table: UserID module directives
              • Preventing inadvertent code execution
              • Summary
                • Chapter 8: Troubleshooting Techniques
                  • Analyzing log files
                    • Error log file formats
                    • Error log file entry examples
                  • Configuring advanced logging
                    • Debug logging
                      • Switching binaries at runtime
                    • Using access logs for debugging
                  • Common configuration errors
                    • Using if instead of try_files
                    • Using if as a hostname switch
                    • Not using the server context to best effect
                  • Operating system limits
                    • File descriptor limits
                    • Network limits
                  • Performance problems
                  • Using the Stub Status module
                  • Summary
                    • Creating new rewrite rules
                    • Translating from Apache
                      • Rule #1: Replace directory and file existence checks with try_files
                      • Rule #2: Replace matches against REQUEST_URI with a location
                      • Rule #3: Replace matches against HTTP_HOST with a server
                      • Rule #4: Replace RewriteCond with if for variable checks
                    • Summary

                        Dimitri Aivaliotis

                        Dimitri Aivaliotis works as a Systems Architect at a hosting provider in Zurich, Switzerland. His career has taken him from building a Linux-based computer network for a school to dual-datacenter high-availability infrastructures for banks and online portals. He has spent over a decade solving his customers' problems and discovered NGINX along the way. He uses the software daily to provide web serving, proxying, and media-streaming services to his customers. Dimitri graduated summa cum laude with a BS in Physics from Rensselaer Polytechnic Institute and received an MS in Management Information Systems at Florida State University. This is his first book.
                        Sorry, we don't have any reviews for this title yet.

                        Submit Errata

                        Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

                        Sample chapters

                        You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                        Frequently bought together

                        Mastering Nginx +    Twilio Cookbook: Second Edition =
                        50% Off
                        the second eBook
                        Price for both: £24.65

                        Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                        What you will learn from this book

                        • 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.


                        This book is a practical step-by-step tutorial with well-explained code snippets, best-practice tips, and reference tables.

                        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.

                        Code Download and Errata
                        Packt Anytime, Anywhere
                        Register Books
                        Print Upgrades
                        eBook Downloads
                        Video Support
                        Contact Us
                        Awards Voting Nominations Previous Winners
                        Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                        Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software