Mastering Nginx

(Ron) #1

Table of Contents



  • Preface

  • 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



  • Chapter 2: A Configuration Guide

    • The basic configuration format

    • NGINX global configuration parameters

      • Table: Global configuration directives



    • Using include files

    • The HTTP server section [ ii ]

      • 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 [ iii ]

      • 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 [ iv ]

      • 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 [ v ]

    • 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



  • Appendix A: Directive Reference

    • Table: Directive reference



  • Appendix B: Rewrite Rule Guide

    • Introducing the rewrite module

      • Table: Rewrite module directives



    • 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



  • Appendix C: The NGINX Community

    • Mailing list

    • IRC channel

    • Web resources

    • Writing a good bug report

    • Summary



  • Appendix D: Persisting Solaris Network Tunings

  • Index

Free download pdf