Co m pl im en ts of nginx A PRACTICAL GUIDE TO HIGH PERFORMANCE Stephen Corona Building a great app is just the beginning NGINX Plus is a complete application delivery platform for fast, flawless delivery Web Server Deliver assets with speed and efficiency Load Balancer Optimize the availability of apps, APIs, and services Streaming Media Stream high-quality video on demand to any device See why the world’s most innovative developers choose NGINX to deliver their apps – from Airbnb to Netflix to Uber. Download your free trial NGINX.com Content Caching Accelerate local origin servers and create edge servers Monitoring & Management Ensure health, availability, and performance of apps with devops-friendly tools This Preview Edition of nginx: A Practical Guide to High Performance, Chapters 1–5, is a work in progress. The final book is currently scheduled for release in October 2015 and will be available at oreilly.com and other retailers once it is published. nginx A Practical Guide to High Performance Stephen Corona Boston nginx by Stephen Corona Copyright © 2015 Stephen Corona. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/ institutional sales department: 800-998-9938 or corporate@oreilly.com . Editor: Allyson MacDonald See http://www.oreilly.com/catalog/errata.csp?isbn=0636920039426 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. nginx: A Practical Guide to High Perfor‐ mance, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights. 978-1-491-92477-8 LSI Table of Contents Foreword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii 1. Getting Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Installing nginx Installing from source Modules in nginx Installing from a package 11 12 14 16 2. Basic Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 The nginx.conf File Configuring and running nginx Filling in the blanks Reloading and Stopping nginx Serving Static Files The Location Block Basic Location Blocks Regular Expression Location Blocks Named Location Blocks Location Block Inheritance Virtualhosts Default Server Block Configuring SSL Sharing a wildcard certificate SNI and the future of SSL 21 22 23 29 31 32 33 35 38 39 39 41 42 43 44 iii 3. CGI, FastCGI, and uWSGI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 How CGI works What is FastCGI? FastCGI Basics FastCGI Basic Config 47 50 50 51 4. Reverse Proxy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Forward Proxy vs Reverse Proxy Configuring a basic Rails Application A more robust reverse proxy Custom Error Pages Adding headers to the upstream Reverse Proxying Node.js & Websockets Reverse Proxy with WebSockets Future Sections in this Chapter 60 63 66 55 57 69 71 75 5. Load Balancing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Your first load balancer Load Balancing vs Reverse Proxy? Han
nginx
温馨提示:如果当前文档出现乱码或未能正常浏览,请先下载原文档进行浏览。
本文档由 user 于 2020-12-27 08:53:39上传分享