Chapter 16. Practical Ops Tips and Conclusion
Introduction
This last chapter will cover practical operations tips and is the conclusion to this book. Throughout this book, we’ve discussed many ideas and concepts pertinent to operations engineers. However, I thought a few more might be helpful to round things out. In this chapter I’ll cover making sure your configuration files are clean and concise, as well as debugging configuration files.
Using Includes for Clean Configs
Problem
You need to clean up bulky configuration files to keep your configurations logically grouped into modular configuration sets.
Solution
Use the include
directive to reference configuration files, directories, or masks:
http { include config.d/compression.conf; include sites-enabled/*.conf }
The include
directive takes a single parameter of either a path to a file or a mask that matches many files. This directive is valid in any context.
Discussion
By using include
statements you can keep your NGINX configuration clean and concise. You’ll be able to logically group your configurations to avoid configuration files that go on for hundreds of lines. You can create modular configuration files that can be included in multiple places throughout your configuration to avoid duplication of configurations. Take the example fastcgi_param configuration file provided in most package management installs of NGINX. If you manage multiple FastCGI virtual servers on a single NGINX box, you can include this configuration ...
Get NGINX Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.