Mastering Nginx

(Ron) #1
Chapter 8

[ 193 ]

2012/10/16 20:56:31 [emerg] 3039#0: "try_files" directive is not allowed
here in /opt/nginx/conf/nginx.conf:16


Sometimes, NGINX will give us a hint as to what is wrong. In the preceding example,


NGINX has understood the try_files directive, but tells us that it is used in the
wrong place. It very conveniently gives us the location in the configuration file where


the error occurred, so that we can find it more easily.


2012/10/16 20:56:42 [emerg] 3043#0: host not found in upstream "tickets.
example.com" in /opt/nginx/conf/nginx.conf:22


This emergency-level message shows us how dependent NGINX is on DNS if


hostnames are used in the configuration. If NGINX can't resolve the hostnames used


in upstream, proxy_pass, fastcgi_pass, or other *_pass directives, then it won't
start. This will have implications on the order in which NGINX is started after a fresh


boot. Ensure that name resolution works at the time when NGINX starts.


2012/10/29 18:59:26 [emerg] 2287#0: unexpected "}" in /opt/nginx/conf/
nginx.conf:40


This type of message is indicative of a configuration error in which NGINX can't


close the context. Something leading up to the line given has prevented NGINX
from forming a complete context with the { and } characters. This usually means


that the previous line is missing a semicolon, so NGINX reads the } character as


part of that unfinished line.


2012/10/28 21:38:34 [emerg] 2318#0: unexpected end of file, expecting "}"
in /opt/nginx/conf/nginx.conf:21


Related to the previous error, this one means that NGINX reached the end of the


configuration file before finding a matching closing brace. This kind of error occurs
when there are unbalanced { and } characters. Using a text editor that matches sets


of braces is helpful in locating exactly where one is missing. Depending on where
that missing brace is inserted, the configuration can end up meaning something


completely different from what was intended.


2012/10/29 18:50:11 [emerg] 2116#0: unknown "exclusion" variable


Here we see an example of using a variable without first declaring it. This means
that $exclusion appeared in the configuration before a set, map, or geo directive


defined what the value was to be. This type of error could also be indicative of


a typo. We may have defined the $exclusions variable, but mistakenly later
referenced it as $exclusion.


2012/11/29 21:26:51 [error] 3446#0: *2849 SSL3_GET_FINISHED:digest check
failed

Free download pdf