NGINX Cookbook
Make the most of your web server
Tim Butler
BIRMINGHAM - MUMBAI
NGINX Cookbook
Copyright 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: August 2017
Production reference: 1300817
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78646-617-4
www.packtpub.com
Credits
Author Tim Butler | Copy Editor Tom Jacob |
Reviewers Claudio Borges Jesse Lawson | Project CoordinatorJudie Jose |
Commissioning EditorPratik Shah | ProofreaderSafis Editing |
Acquisition Editors Prachi Bisht Subho Gupta | Indexer Tejal Daruwale Soni |
Content Development EditorMonika Sangwan | Graphics Kirk D'Penha |
Technical EditorBhagyashree Rai | Production Coordinator Arvindkumar Gupta |
About the Author
Tim Butler is currently working in the web hosting industry and has nearly 20 years of experience. He currently maintains hyper-converged storage/compute platforms and is an architect of high throughput web logging and monitoring solutions.
You can follow him on Twitter using his Twitter handle, @timbutler, where he (infrequently) posts about hosting, virtualization, NGINX, containers, and a few other hobbies.
About the Reviewers
Claudio Borges is a systems engineer with a computer science degree and over 15 years of experience in Linux/BSD. He has strong knowledge of systems administration and deployment with extensive experience in developing tools to automate systems and tasks.
I am grateful to all of those with whom I have had the pleasure to work during this project. I am especially indebted to the Packt team for giving me this opportunity.
This work would not have been possible without my family's supportmy loving and supportive wife, Rose and my wonderful daughter, Victoria, who provide unending inspiration.
Jesse Lawson is a PhD student at Northcentral University and an information systems administrator at Butte College in Oroville, CA. His research addresses two primary areas: consumer psychology in higher education administration, and data science and analytics in the social sciences. His dissertation explores how machine learning models compare to human-generated processes of predicting college student outcomes, and what it means if people are better at predicting student dropout behavior than algorithms. He is the author of the bestselling book Data Science in Higher Education, published by CreateSpace Independent Publishing Platform; he is a technical reviewer for Packt Publishing; and a former technical reviewer for the International Journal of Computer Science and Innovation.
I'd like to thank my wife, Sami, for her uncompromising support to my pursuits.
www.PacktPub.com
For support files and downloads related to your book, please visit www.PacktPub.com . Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details. At www.PacktPub.com , you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Why subscribe?
- Fully searchable across every book published by Packt
- Copy and paste, print, and bookmark content
- On demand and accessible via a web browser
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://www.amazon.com/dp/1786466171 .
If you'd like to join our team of regular reviewers, you can email us at customerreviews@packtpub.com. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
Table of Contents
Preface
NGINX Cookbook covers the basics of configuring NGINX as a web server for use with common web frameworks such as WordPress and Ruby on Rails, through to utilization as a reverse proxy. Designed as a go-to reference guide, this book will give you practical answers based on real-world deployments to get you up and running quickly.
Recipes have also been provided for multiple SSL configurations, different logging scenarios, practical rewrites, and multiple load balancing scenarios. Advanced topics include covering bandwidth management, Docker container usage, performance tuning, OpenResty, and the NGINX Plus commercial features.
By the time you've read this book, you will be able to adapt and use a wide variety of NGINX implementations to solve any problems you have.
What this book covers
, Let's Get Started, goes through some of the basics of NGINX as a refresher. It's aimed as an entry point so that there's no assumed knowledge when we move onto some of the more complex structures.
, Common PHP Scenarios, covers examples of the more common PHP scenarios and how to implement them with NGINX. The readers will learn how to configure NGINX and how to deploy a basic site.
, Common Frameworks, covers non-PHP-based frameworks. It will help the readers to understand and implement all of the common non-PHP-based platforms via NGINX.
, All About SSLs, covers installing the various SSL certificates via NGINX and also covers the configuration required to tweak it for certain scenarios.
, Logging, explains that monitoring for errors and access patterns are fundamental to running a server.