Book Image

Nginx Essentials

By : Valery Kholodkov, Valery I Kholodkov
Book Image

Nginx Essentials

By: Valery Kholodkov, Valery I Kholodkov

Overview of this book

Table of Contents (13 chapters)

Preface

2006 was an exciting year. The disappointment that surrounded the dot-com crash had pretty much been superseded by a renewed and more confident growth of Web 2.0 and inspired a search for technologies of a new age.

At that time, I was looking for a web server to power my projects that would do many things in a different way. After getting some experience in large-scale online projects, I knew that the popular LAMP stack was suboptimal and sometimes did not solve certain challenges, such as efficient uploads, geo-dependent rate limiting, and so on.

After trying and rejecting a number of options, I came to know about Nginx and immediately felt that my search was over. It is small yet powerful, with a clean code base, good extensibility, relevant set of features, and a number of architectural challenges solved. Nginx definitely stood out from the crowd!

I immediately got inspired and felt some affinity to this project. I tried participating in the Nginx community, learned, shared my knowledge, and contributed as much as I could.

With time, my knowledge of Nginx grew. I started to get consultancy requests and have been capable of addressing quite sophisticated cases. After some time, I realized that some of my knowledge might be worth sharing with everyone. That's how I started a blog at www.nginxguts.com.

A blog turned out to be an author-driven medium. A more reader-focused and more thorough medium was in demand, so I set aside some time to assemble my knowledge in the more solid form of a book. That's how the book you're holding in your hands right now came into existence.

What this book covers

Chapter 1, Getting Started with Nginx, gives you the most basic knowledge about Nginx, including how to carry out the very basic installation and get Nginx up and running quickly. A detailed explanation of the structure of the configuration file is given so that you know where exactly code snippets from the rest of the book apply.

Chapter 2, Managing Nginx, explains how to manage an operating Nginx instance(s).

Chapter 3, Proxying and Caching, explains how to turn Nginx into a powerful web proxy and cache.

Chapter 4, Rewrite Engine and Access Control, explains how to use the rewrite engine to manipulate URLs and secure your web resources.

Chapter 5, Managing Inbound and Outbound Traffic, describes how to apply various restrictions to inbound traffic, and how to use and manage upstream.

Chapter 6, Performance Tuning, explains how to squeeze the most out of your Nginx server.

What you need for this book

A good knowledge of Unix-like operating systems is required, presumably Linux, along with some web master experience.

Who this book is for

This book intends to enrich web masters' and site reliability engineers' knowledge of subtleties known to those who have a deep understanding of the Nginx core. At the same time, this book is a from the start guide that allows beginners to easily switch to Nginx under experienced guidance.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, folder names, filenames, file extensions, pathnames, dummy URLs, and user input, are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

types {
    text/html                   html htm shtml;
    text/css                    css;
    text/xml                    xml;
    image/gif                   gif;
    image/jpeg                  jpeg jpg;
    application/x-javascript    js;
    application/atom+xml        atom;
    application/rss+xml         rss;
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

types {
    text/html                   html htm shtml;
    text/css                    css;
    text/xml                    xml;
    image/gif                   gif;
    image/jpeg                  jpeg jpg;
    application/x-javascript    js;
    application/atom+xml        atom;
    application/rss+xml         rss;
}

Any command-line input or output is written as follows:

# cp /usr/local/nginx/nginx.conf.default
     /etc/nginx/nginx.conf

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Clicking the Next button moves you to the next screen."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Elisions of sections of configuration files are shown as […] or with a comment [… this part of the configuration file is up to you ...]

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

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.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.