Errata

nginx

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
PDF Page iii
TOC

I've skimmed over most of the book, and don't recall seeing anything substantive about logging. Is there a planned section or chapter on configuring what information goes to a log file, where the log file lives, how to read the log file entries, etc.? Or is this not really a concern, e.g., because it's not that complicated or not that configurable?

dml  Aug 10, 2015 
PDF Page 1
2nd paragraph

Most occurrences of the em dash have a space after it, which is unusual; e.g., "It can do so much more-- it can serve ..."

Also, an em dash is frequently used to start a multiline example, instead of the usual colon; e.g., in the first paragraph of page 28:

... if you wanted a server to listen on two different ports--

server {
listen *:80;
listen *:81;
}

Jon Willeke  Aug 09, 2015 
PDF Page 4
example after 1st paragraph

The two hyphens in "--conf-path" are rendered as an em dash.

Jon Willeke  Aug 09, 2015 
PDF Page 12
Installing build tools

yum group install "Development Tools"

should be

yum groupinstall "Development Tools"

Konstantin  Apr 01, 2016 
PDF Page 14
First code sample

The code example for customizing the install/configuration locations when building from source is listed as:

`
$ ./configure --prefix=/usr —conf-path=/etc/nginx
`

I had to set `--conf-path` to the location of the nginx.conf file, not a directory. If set as a directory, the following error occurs in `nginx -t`:

`
nginx: [crit] pread() "/etc/nginx" failed (21: Is a directory)
`

Steve Hansell  Jul 22, 2015 
PDF Page 16
Third party modules

The link to wiki.nginx.org returns a 404 error. The correct URL is https://www.nginx.com/resources/wiki/modules/.

Nathan Walker  Jul 16, 2016 
PDF Page 22
first para under "Configuring and running nginx"

"and quiet readable" --> "and quite readable"

dml  Jul 31, 2015 
PDF Page 22
2nd paragraph

"a nginx.conf file" -> "an nginx.conf file" (one wouldn't say "a engine x file", but rather "an engine x file")

Paul Madden  Nov 14, 2018 
PDF Page 23
caption for Example 2-1

"with defaults values" --> "with default values"

dml  Jul 31, 2015 
PDF Page 27
first full para

"settings that drive event loop" --> "settings that drive the event loop"

dml  Aug 02, 2015 
PDF Page 27
3rd full para

"e.g," --> "e.g.," (missing period)

This typo appears elsewhere in text.

dml  Aug 02, 2015 
PDF Page 27
subheading "Listen Directive"

Subheading ends in a period; other subheads do not.

Note the next subheading ("Server_name Directive"), on the next page, also has the period, and furthermore is inline with the paragraph. So there appears to be some lack of typesetting consistency with subheads all around.

dml  Aug 02, 2015 
PDF Page 28
2nd para under "Server_name Directive"

"to indicate which domain name that it’s attempting to access" --> "to indicate which domain name it’s attempting to access"

dml  Aug 02, 2015 
PDF Page 31
1st para

"will be running and serving request"
-->
"will be running and serving requests"

dml  Aug 02, 2015 
PDF Page 31
3rd para under "Serving Static Files"

"etc" --> "etc." (missing period)

dml  Aug 02, 2015 
PDF Page 32
Caption of Example 2-3

Caption states "Make foobar.html the index" but the example actually makes `ADifferentIndexFile.html` the index.

dml  Aug 03, 2015 
PDF Page 32
3rd para under "Location Block"

"provide a custom configuration for incoming request" probably should say "for an incoming request" or "for the incoming request".

dml  Aug 03, 2015 
PDF Page 32
4th para under "Location Block"

"more elegant rule to express similar functionality as Rewrite Rules" might read better if the first "rule" was "way" (especially since none of the other configuration file entries have been described as "rules").

dml  Aug 03, 2015 
PDF Page 34
1st sentence under Example 2-7

"will be resolves to" --> "will be resolved to" or "will resolve to"

dml  Aug 03, 2015 
PDF Page 34
2nd para under Example 2-7

"If we has used root instead, the same request uri would resolve to the path /data/images/gif/business_cat.gif instead."

+ "If we has" --> "If we had" (or get rid of "has" entirely).

+ `root` should be typeset in italics, similarly to `alias` at the top of the page. Note also that `alias` in the next paragraph has a similar lack of formatting.

+ As somebody else has noted, `/gif/` in the URI should be `/gifs/`.

dml  Aug 03, 2015 
PDF Page 34
2nd para under Example 2-7

In my earlier comments on this paragraph, I forgot to mention, "uri" should be in caps.

dml  Aug 03, 2015 
34
Example 2-7. Location Block Using Alias

IT IS:
'If we has used root instead, the same request uri would resolve to the path /data/images/gif/business_cat.gif instead.'

IT SHOULD BE:
'If we HAD used root instead, the same request uri would resolve to the path /data/images/gif/business_cat.gif instead.'

Anonymous  Mar 17, 2017 
PDF Page 35
Section "Regular Expression Location Blocks"

3rd para of this section states that regex blocks are processed in order of declaration. Not until bottom of next page are we told that regexes get matched after prefix locations (and, presumably, exact match locations).

Might be nice to spell out the priority rules all in one place, rather than piecemeal.

dml  Aug 03, 2015 
PDF Page 35
section "Regular Expression Location Blocks"

Since this section leans heavily on regexes, it might be nice to provide a pointer to a reference or learning site about them. At least mention what flavor of regex gets used.

dml  Aug 03, 2015 
PDF Page 36
1st para after Example 2-14

"Because regular expressions are matched after the prefix locations, if there is a request URI for /foobar/images/dog.gif, the regular expression block will always be used."

I find this confusing. If prefix locations get matched before regex locations, that implies that `/foobar/images/dog.gif` should get matched to the prefix location `/foobar/images`.

This, at least, is the mental model I formed when I read, earlier, that "Location blocks with an exact match modifier are the first blocks to be checked for a match and will terminate the search and immediately be selected for use." In other words, what I have read up to this point implies that the order of match attempts is fixed, and as soon as a match is found, the search terminates.

But here, apparently, the order of selection is done in the inverse of the order of matching (because here the regex location gets checked last and therefore gets used).

So either this sentence is not right, or there is something not explicit about how the locations get matched-- for example, that all possible matches are considered, and the most recent one (or most explicit one) gets selected.

Broadly looking for clarification of this point.

dml  Aug 03, 2015 
PDF Page 37
section "Location Block Selection Algorithm"

This section definitely addresses my questions about priority (if I could edit my earlier comments, I would combine all of them).

However, I think this section comes too late, given the confusing before/after language that I pointed out in a previous comment.

After reading this big, I think I would suggest changing that paragraph at the bottom of p.36 to state, correctly, that regex locations are matched _before_ prefix locations.

In addition, I think the priority list could be made more clear by distinguishing between simple, unadorned prefix blocks, and
those with the ^~ modifier. Then one could simply give the priorities as:
1. Exact match.
2. Prefix blocks with ^~ modifier, in order of specificity.
3. Regex blocks, in sequential order.
4. Prefix blocks without ^~ modifier, in order of specificity (and one could invent some terminology, like, say, "unadorned" or "simple" prefix blocks, to cement the distinction conferred by the ^~ modifier).

That seems more straightforward than the current ordered list, in which step #2 describes a mostly-deferred matching against all the prefix blocks, with step 2a to describe immediate action and step 4 to describe deferred action. Even if that accurately describes what nginx does "under the covers", that's just an implementation detail.

Alternately, you might consider moving this section up a little earlier (say, to appear between the section on "Basic Location Blocks" and that on Regex Location Blocks"). It would probably be OK to read about the priorities up-front and all at once, with a promise to explain the regex ones shortly. Although I don't think this is really necessary, provided the "after" discussion gets cleaned up a bit.

Finally, in this section I would separate out the table from the list. Graphically, I think enclosing the table in the box looks a little busy. So I would consider writing the section as a straightforward description of the algorithm, with a reference to a stand-alone table to remind readers what the various location blocks look like.

dml  Aug 04, 2015 
PDF Page 38
1st para under Example 2-16

"In it's current form" --> "In its current form" (remove apostrophe) (note apostrophe is OK in second "it's" of this paragraph)

dml  Aug 03, 2015 
PDF Page 41
para before "Default Server Block"

"they allow you pass" --> "they allow you to pass"

dml  Aug 04, 2015 
PDF Page 41
1st para after priority list for server_name

"If there no server_name directives that match"
-->
"If there are no server_name directives that match"
or
"If no server_name directives match"

Also, `server_name` should be typeset appropriately.

dml  Aug 04, 2015 
PDF Page 42
1st para after Example 2-23

"server block that server" --> "server block that serves"

dml  Aug 04, 2015 
PDF Page 42
sentence ending "path to the key for the certificate"

Sentence is missing its period.

dml  Aug 04, 2015 
PDF Page 43
scorpion topic "Beware outdated SSL information"

"In previous versions of nginx, there were substantially different ways to configure SSL that are no longer valid syntax or non- optimal."

That sentence is hard to parse, because the last bit can be read as "no longer valid, or no longer non-optimal" (which is clearly not intended).

Suggest "no longer valid syntax, or are non-optimal".

Better might be "Previous versions of nginx used substantially different ways to configure SSL. Some are no longer valid syntax; others are non-optimal."

dml  Aug 04, 2015 
PDF Page 44
Table at bottom

SNI is supported on all Chrome platforms, not "Windows version only Vista or newer"

Eric Lawrence  Aug 31, 2015 
PDF Page 47
3rd para

"CGI is a programming language independent" --> "CGI is programming language independent" (remove "a").

dml  Aug 04, 2015 
PDF Page 49
table of CGI environment variables

"The Length of the HTTP Request"

"Length" should not be capitalized.

"Request" probably should not be capitalized (and is not capitalized elsewhere in the table).

Also, this cell of the table got some kind of odd vertical spacing, compared to the others.

dml  Aug 04, 2015 
PDF Page 50
first paragraphs

Awkward: "There’s generally two different ways" -> "There are two ways"

Awkward: "it’s best practice" -> "it's a best practice"

Eric Lawrence  Aug 31, 2015 
PDF Page 52
location block near top of page

The location block uses a case-sensitive regex:
`location ~ script.php {...`

The following text states that this matches a single PHP script, script.php.

If the intent is to match a single script, it isn't clear why one would not use an exact match location block, or a basic prefix location block.

dml  Aug 04, 2015 
PDF Page 52
1st para under "Many individual PHP Files"

"configuration" --> "configurations"

dml  Aug 04, 2015 
PDF Page 52
near bottom

Leftover placeholder text

"Watch out for old syntax!
Please be warned about something important!"

Eric Lawrence  Aug 31, 2015 
PDF Page 53
3rd paragraph of the scorpion

"What that means that if" --> "What that means is that if"

Jon Willeke  Aug 09, 2015 
PDF Page 55
1st para under "Forward Proxy vs Reverse Proxy"

"the following chapters on Load Balancing and FastCGI"

The chapter on FastCGI precedes this one, rather than following it.

dml  Aug 04, 2015 
PDF Page 55
3rd paragraph

Should have a semicolon not a comma.

Instead of:

"It’s just a webserver and generally tries to keep its footprint very small,
running a web application is delegated to a separate server and proxies upstream."

use:


"It’s just a webserver and generally tries to keep its footprint very small;
running a web application is delegated to a separate server and proxies upstream."

Eric Lawrence  Aug 31, 2015 
PDF Page 56
1st para after Figure 4-2

Capitalize "Ruby" (two places).

dml  Aug 04, 2015 
PDF Page 56
2nd para after Figure 4-2

"This is the exact same concept as Load Balancing a Chapter 4"

First of all, this isn't a sentence. Probably you mean "in" Chapter 4.

Second of all, Load Balancing is Chapter 5.

It seems like some re-arrangement of chapters has taken place, since the forward and backward references are mixed up in a few places. So I suspect this discussion of load balancing was written at a time when the Load Balance chapter came before this Reverse Proxy chapter. If that's the case, you might want to revise this discussion of Load Balancing to remove the apparent assumption that the reader has already encountered it.

dml  Aug 04, 2015 
PDF Page 57
second para

"In fact, because reverse proxy just proxies HTTP,"

should be:

"In fact, because reverse proxies just proxy HTTP,"

Awkward: "and most dynamic web applications speak HTTP" -- by definition, ALL web applications "speak HTTP".

Eric Lawrence  Aug 31, 2015 
PDF Page 58
2nd para under Figure 4-3

"Rack-based server ... are great" --> "Rack-based servers ... are great"

dml  Aug 04, 2015 
PDF Page 59
3rd para after Example 4-1

"waiting for earlier WEBrick to processes to finish" --> "waiting for earlier WEBrick processes to finish" (remove extraneous "to").

dml  Aug 04, 2015 
PDF Page 59
1st para after Example 4-1

"This configuration has nginx receiving every incoming request on port 80 and forwards it"
-->
"This configuration has nginx receiving every incoming request on port 80 and forwarding it" (make "receiving" and "forwards" parallel).

dml  Aug 04, 2015 
PDF Page 59
5th para after Example 4-1

"through to WEBrick,"

Sentence should end with a period.

dml  Aug 04, 2015 
PDF Page 59
6th para after Example 4-1

"What we’d actually prefer to serve"
-->
"What we’d actually prefer is to serve"
OR
"We’d actually prefer to serve"

dml  Aug 04, 2015 
PDF Page 59
server block example at bottom of page/top of page 60

The configuration file is getting more and more complicated. If I had a blank location block, like the one shown in the example here, I would certainly want to add comments in the config file to remind myself what's going on:
location /assets {

}

I don't remember reading anything about how to add comments to a configuration file.

Searching the PDF for the word "comment" turns up an instance on page 74 ("The reason that you’d use down to remove a server instead of commenting it out..."). This implies it is possible to have comments in the config file. And the example on page 81 (right before "Weighted Servers") implies one uses a C-style # to comment through the end of the line.

It would be nice to mention how to do this, in Chapter 2.

dml  Aug 04, 2015 
PDF Page 61
1st para (just before Example 4-2)

"length" --> "lengthy"

dml  Aug 04, 2015 
PDF Page 61
1st para after Example 4-2

"to it’s own" --> "to its own" (remove apostrophe)

dml  Aug 04, 2015 
PDF Page 61
1st para after Example 4-2

"...check for the existence of maintenance.html, which will short-circuit forwarding the request to the upstream if it exists."

This is confusing for two reasons.

First, to the upstream what? I assume this means to the upstream server, meaning WEBrick in the running example. And that makes sense given that "upstream" is a keyword in the config file. However the phrase "the upstream" has not been defined yet. I see from the Table of Contents that "the upstream" seems to be a term of art, but to my best memory it hasn't been introduced as a term yet. I would try to make a point that "the upstream" is a way of talking about the proxy tagged as "upstream" in the config file, before casually using it this way. Alternately, typeset "upstream" so that it's clearly identified as a keyword.

Second, and more important, I believe the "it" here refers to `maintenance.html`. That is, forwarding the request to the upstream will get short-circuited if `main.html` exists. The problem here is that "the upstream" intervenes between "maintenance.html" and "it", so "it" becomes identified with "the upstream" rather than with the file.

A suggested rewrite would be "check for the existence of maintenance.html. Then if maintenance.html exists, nginx will not forward the request to the upstream server."

dml  Aug 05, 2015 
PDF Page 61
last para before Example 4-3

"add yet-another location block to configuration" --> "add yet-another location block to the configuration" (add "the").

Also, one would normally write "yet another" (with no hyphen).

dml  Aug 05, 2015 
PDF Page 62
2nd para after Example 4-4

"If we were set the root"
-->
"If we were to set the root"
OR
"If we set the root"

dml  Aug 05, 2015 
PDF Page 62
2nd para after Example 4-4

"If we were [to] set the root one level lower, for example, to /path/to/application"

The example of setting the path the `path/to/application` presumably stands in contrast to the root set in Example 4-3, namely, `path/to/application/public`.

Is it conventional to describe directory `a/b/c` as "one level lower" than directory `a/b/c/d`? I have always heard that relationship described as "one level up" in the directory structure, and hence I think of `a/b/c` as "higher" than `a/b/c/d`.

dml  Aug 05, 2015 
PDF Page 67
3rd para

"if use use the subdomain" ("use" appears twice)

dml  Aug 09, 2015 
PDF Page 70
box

"If you’re running Node in product," -> "If you’re running Node in production"

Eric Lawrence  Aug 31, 2015 
PDF Page 73
middle

"Let’s dissect the map bit, because I always think that these can be confusing at first glance if you haven’t used it before."

should be:

"Let’s dissect the map directive, because it can be confusing if you haven’t used it before."

Eric Lawrence  Aug 31, 2015 
PDF Page 80
2nd paragraph after example

"clients are supposed to chose" --> "clients are supposed to choose"

Jon Willeke  Aug 09, 2015 
PDF Page 80
4th paragraph after example

"Worst still" --> "Worse still"

Jon Willeke  Aug 09, 2015 
PDF Page 81
1st paragraph

"where we used to connect" --> "where we used it to connect"?

Jon Willeke  Aug 09, 2015 
PDF Page 81
3rd paragraph of the scorpion

"or a mix any of the above" --> "or a mix of any of the above"

Jon Willeke  Aug 09, 2015 
PDF Page 84
1st paragraph of "Removing a server from the pool" section

"it no longer servers web traffic." --> "it no longer serves web traffic."

Jon Willeke  Aug 09, 2015 
PDF Page 86
bottom

Final line of the page overlaps the footer line / text.

Eric Lawrence  Aug 31, 2015 
PDF Page 88
5th paragraph

"having uses routed" --> "having users routed"

Jon Willeke  Aug 09, 2015 
PDF Page 89
4th paragraph

The paragraph has:

If you’re using internal hosts, that’s usually file, as the IPs don’t often change.

It should be:

If you’re using internal hosts, that’s usually fine, as the IPs don’t often change.



Title of this page:
DNS Resolution in nginx Upstream Directive

Theodore Baschak  Jul 18, 2015