Автор: Dimitri Aivaliotis
Издательство: Packt Publishing
Качество: Изначально компьютерное (eBook)
Интерактивное оглавление: Да
Количество страниц: 322
An in-depth guide to configuring NGINX for any situation, including numerous examples and reference tables describing each directive.
NGINX is a high-performance web server designed to use very few system resources. There are many how-to's and example configurations floating around on the Web. This guide will serve to clarify the murky waters of NGINX configuration. In doing so you will learn how to tune NGINX for various situations, what some of the more obscure configuration options do, and how to design a decent configuration to match your needs.
You will no longer feel the need to copy-paste a configuration snippet because you will understand how to construct a configuration file to do exactly what you want it to do. This is a process, and there will be bumps along the way, but with the tips explained in this book you will feel comfortable writing an NGINX configuration file by hand. In case something doesn't work as expected, you will be able to debug the problem yourself or at least be capable of asking for help without feeling like you haven't given it a try yourself.
This book is written in a modular fashion. It is laid out to help you get to the information you need as quickly as possible. Each chapter is pretty much a standalone piece. Feel free to jump in anywhere you feel you need to get more in-depth about a particular topic. If you feel you have missed something major, go back and read the earlier chapters. They are constructed in a way to help you grow your configuration piece-by-piece.
Author: 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 up through 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.
Код: Выделить всё
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 Â Â 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 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