nginx 在“set”指令中设置了无效数量的参数

Sla*_*akk 5 nginx nginx-location

我正在使用 nginx 文档中描述的 set 指令,但我不断收到此错误:

nginx_1     | 2016/09/13 15:06:08 [emerg] 8#8: invalid number of arguments in "set" directive in /etc/nginx/conf.d/default.conf:9
nginx_1     | nginx: [emerg] invalid number of arguments in "set" directive in /etc/nginx/conf.d/default.conf:9
Run Code Online (Sandbox Code Playgroud)

默认.conf:

server {
    set $dn "foo.dnsalias.net";
    ...
}
Run Code Online (Sandbox Code Playgroud)

我试过带引号和不带引号,没有任何变化。

我正在使用 nginx 版本 1.10.1

有谁知道问题是什么?

Dra*_*kes 7

在你的片段中你有

server {
    set $dn "foo.dnsalias.net";
    ...
}
Run Code Online (Sandbox Code Playgroud)

但是,如果在实际的;conf 文件中指令后缺少尾随分号set,则该指令将不会终止,并且下一行上的文本将被视为附加参数,这将触发错误。