On Sat, Jan 12, 2013 at 09:40:14PM -0800, Daniel L. Miller wrote:
something that works with $a
Within the scope of the commands of test.conf, will $a be “hello” or
“world”? Currently my usage like this gives me a, “using
unitialized variable” warning.
The “include” directive works during configuration parsing and
completely transparent to everything else. That is, you may set a
variable in one file and then use it in an included file, it is
expected to work fine.
On the other hand, example you’ve provided is syntactically
invalid and will result in the following error during
nginx: [emerg] invalid number of arguments in “set” directive in …
Correct way to write it would be
set $a “hello”;
Note there is no “=” character. See http://nginx.org/r/set for
Note well, that after fixing the example the $a at the end of
test.conf will be either “world” (if test.conf goes after ‘set $a
“hello”;’) or uninitialized if it’s included somewhere else.