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.
Published by Packt Publishing Ltd.
Birmingham B3 2PB, UK..
Credits
Author
Dimitri Aivaliotis
Reviewers
Yasir Adnan
Andrew Alexeev
Antonio P. P. Almeida
Rainer Duffner
Acquisition Editor
Usha Iyer
Lead Technical Editor
Azharuddin Sheikh
Technical Editors
Varun Pius Rodrigues
Lubna Shaikh
Project Coordinator
Abhishek Kori
Proofreader
Aaron Nash
Indexer
Tejal Soni
Graphics
Aditi Gajjar
Production Coordinator
Manu Joseph
Cover Work
Manu Joseph
About the Author
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.
I would like to thank John Blackwell and Phil Margolis for reading early drafts of the manuscript. Their criticism and tips have helped me greatly and made this a better book. I would also like to thank the technical reviewers for providing constructive feedback and pointing out errors I have made along the way. Any remaining errors are of course my own.
The team at Packt Publishing has been really supportive in getting this project off the ground.Their faith in me as a writer has bolstered me during the dark times of missed deadlines.
The knowledge and support of the NGINX, Inc. team has been instrumental in filling in the gaps in my understanding of how NGINX works. I could not have written this book without them.
An especially heartfelt thanks goes out to my family. My wife and children have had to cope with my many writing sessions. Their patience during this time is greatly appreciated.
About the Reviewers
Yasir Adnan lives in Dhaka, Bangladesh. He is a computer science student. He also works as a freelance programmer. He has worked on both mobile and web applications. Nowadays he mainly develops mobile applications. He can be reached at <>
.
Andrew Alexeev is a co-founder of NGINX, Inc.the high performance web company behind the NGINX web server. Prior to joining NGINX, Inc. at the beginning of 2011, Andrew worked in the Internet industry and in a variety of ICT divisions for enterprises. Andrew holds a diploma in Electronics from St. Petersburg Electrotechnical University and an executive MBA from Antwerp Management School.
Antonio P.P. Almeida (@perusio
) has been obsessed with NGINX and high-performance web stacks ever since he was trying to develop for Drupal on a battered 1.3 GHz Centrino-based laptop and Apaches resource appetite made NGINX inevitable. He has been learning how to get the most out of NGINX in all possible kinds of applications, in particular all the subtleties of NGINX configuration language. He lives and works in Paris. Besides NGINX, his other main obsessions are obscure late Italian medieval music, cinema, and how to make Drupal more awesome.
Rainer Duffner received a degree in Information Systems from the University of Applied Science in Konstanz, Germany, and currently works as a Systems Engineer at EveryWare AG, where he helps customers get the most out of their managed dedicated FreeBSD, Linux, and Solaris servers. He lives in a small town next to Zurich, Switzerland, and enjoys spending his free time on a mountain bike around Zurich and the Swiss mountains.
Id like to thank Dimitri for the opportunity to help review this fine book. Its a useful resource all along.
www.PacktPub.com
Support files, eBooks, discount offers and more
You might want to visit www.PacktPub.com for support files and downloads related to your book.
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 > 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.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packts online digital book library. Here, you can access, read and search across Packts entire library of books.
Why Subscribe?
- Fully searchable across every book published by Packt
- Copy and paste, print and bookmark content
- On demand and accessible via web browser
Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Dedicated to my father, who has always said I can do anything I set my mind to.
Preface
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.