Nginx Troubleshooting
eBook - ePub

Nginx Troubleshooting

  1. 172 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Nginx Troubleshooting

About this book

Investigate and solve problems with Nginx-powered websites using a deep understanding of the underlying principles

About This Book

  • Solve problems with your Nginx-powered websites before your audience notices anything
  • Peek into the Nginx architecture and gain knowledge that will help you be valuable to you in the long run
  • Gain knowledge of different types of problems in a step-by-step way

Who This Book Is For

The book is for technical specialists who already use Nginx to serve web pages for their users. Whether you are an experienced system administrator or a new professional, this book will help you do your job in the most efficient way.

What You Will Learn

  • Detect and investigate problems with your web servers
  • Create correct and professional configuration files
  • Get an in-depth understanding of the web server software
  • Interpret Nginx log files easily and with actionable insights
  • Make your websites respond as fast as possible
  • Prevent problems by setting up proper monitoring and alerts

In Detail

Nginx is clearly winning the race to be the dominant software to power modern websites. It is fast and open source, maintained with passion by a brilliant team. This book will help you maintain your Nginx instances in a healthy and predictable state.

It will lead you through all the types of problems you might encounter as a web administrator, with a special focus on performance and migration from older software.

You will learn how to write good configuration files and will get good insights into Nginx logs. It will provide you solutions to problems such as missing or broken functionality and also show you how to tackle performance issues with the Nginx server. A special chapter is devoted to the art of prevention, that is, monitoring and alerting services you may use to detect problems before they manifest themselves on a big scale. The books ends with a reference to error and warning messages Nginx could emit to help you during incident investigations.

Style and approach

This comprehensive tutorial on Nginx troubleshooting takes an practical approach to guiding you through common issues in Nginx server.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

Information

Nginx Troubleshooting


Table of Contents

Nginx Troubleshooting
Credits
About the Author
About the Reviewers
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Searching for Problems in Nginx Configuration
Introducing basic configuration syntax, directives, and testing
Simple directives
Multiline directives
Include directive
Testing Nginx configuration
The default configuration directory layout
A quick example of modifying the MIME types registry
Default nginx.conf
The http directive
Common mistakes in configuration
Semicolons and newlines
File permissions
Variables
Regular expressions
Summary
2. Searching for Problems in Log Files
Configuring Nginx logging
Logging POST requests
Conditional logging
Logging big request bodies
Creating infrastructure around logs
Configuring log rotation
Working with a lot of log data
Reading logs
Error log record
Summary
3. Troubleshooting Functionality
Processing a complain
Rolling back
Keeping Nginx configuration under source control
Keeping a case journal
Performing the simplest test
Performing the Internet connection test
Testing the general HTTP response traffic
Detecting a lying application
Working around an integration failure
The try_files directive
Setting up automatic removal from upstream
Configuring the good old SSI
Planning for more complete monitoring
Processing a situation of no traffic
Restarting Nginx properly
Investigating lower than usual traffic
Summary
4. Optimizing Website Performance
Why Nginx is so fast?
Optimizing individual upstreams
Optimizing static files
Optimizing PHP backends
Java backends
Optimizing Python and Ruby backends
Optimizing Perl backends
Using thread pools in Nginx
The caching layer of Nginx
Emitting caching headers
Caching in Nginx upstream modules
Caching static files
Replacing external redirects with internal ones
Summary
5. Troubleshooting Rare Specific Problems
Security warnings
Domain name mismatch
Expired certificates
Insecure warnings for valid certificates
The mixed – content warning
Building a secure proxy for the external content
Solving problems with cache
Obsolete pages and VirtualBox
Apache migration problems
Solving problems with WebSockets
Showing a file upload progress bar
Solving the problem of an idle upstream
Summary
6. Monitoring Nginx
Using ngxtop
Getting statistics from http_stub_status
Monitoring Nginx with Munin
Configuring alerts
Getting more status data from Nginx
Using Nginx Plus alternatives
nginx-module-vts
Luameter
nginx-lua-stats
The upsteam_check module in tengine
The requests/sec patch by Catap
The Ustats module
Summary
7. Going Forward with Nginx
System administration
Linux/Unix operating system as a whole
Modern Internet protocols
Specific backend software used in your company
Modern cloud platforms
Automation
Software development
Summary
A. Rare Nginx Error Messages
Index

Nginx Troubleshooting

Copyright © 2016 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: April 2016
Production reference: 1190416
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78528-865-4
www.packtpub.com

Credits

Author
Alex Kapranoff
Reviewers
Titouan Galopin
Valery Kholodkov
Commissioning Editor
Dipika Gaonkar
Acquisition Editor
Reshma Raman
Content Development Editor
Sanjeet Rao
Technical Editor
Mohit Hassija
Copy Editor
Dipti Mankame
Project Coordinator
Judie Jose
Proofreader
Safis Editing
Indexer
Priya Sane
Graphics
Kirk D'Penha
Production Coordinator
Shantanu N. Zagade
Cover Work
Shantanu N. Zagade

About the Author

Alex Kapranoff is an established IT professional with more than 20 years of experience in roles ranging from a database developer to the CTO of a social search engine start-up to an infrastructure manager of a huge web application with hundreds of millions of users. His background allows him to be more on the developer side of things, and he is happy to share some of that perspective with fellow system administration specialists.

About the Reviewers

Titouan Galopin is a certified PHP/Symfony French web architect from Paris. He currently works for SensioLabs, the company behind the PHP framework Symfony, and he has worked for various other companies, including LIIP, Emakina, Ademis, and Coburo.
Titouan graduated in computer science and information technology from the Paris-Saclay University, and he is currently pursuing an engineering degree at the University of Technology of Compiègne.
First as a web developer and then as a web architect since 2012, Titouan has worked on Nginx intensively for PHP applications and Dockerized environments. Within the few years of his work, he has accumulated a lot of experience with Nginx and shares his experience in this book and in the related one, Nginx High Performance, Packt Publishing.
Valery Kholodkov is a seasoned IT professional with a decade of experience in creating, building, scaling, and maintaining industrial-grade web services, web applications, and mobile application backends. Throughout his career, he has worked for well-known brands such as Yandex, Booking.com, and AVG. He currently works as the CTO of QubiQ Digital, a consumer acquisition agency. Valery has a deep understanding of technology, and he is able to express its essence, advantages, and risks to a layman, which makes him an accomplished author and technical reviewer.

www.PacktPub.com

eBooks, discount offers, and more

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 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.
eBooks, discount offers, and more
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's 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 a web browser

Preface

You will learn how to notes problems before your boss calls you about some pages not loading. You will learn how to find those problems using logs and your usual Linux toolbox. You will also learn how to minimize the probability of problems happening again.
Nginx started as a web acceler...

Table of contents

  1. Nginx Troubleshooting

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Nginx Troubleshooting by Alex Kapranoff in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Desarrollo web. We have over one million books available in our catalogue for you to explore.