Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx set invalid number of arguments in "set" directive

I'm using the set directive as described in the nginx doc but I keep getting this error:

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

default.conf :

server {
    set $dn "foo.dnsalias.net";
    ...
}

I've tried both with and without quotes, with no change.

I'm using nginx version 1.10.1

Does anyone know what the issue is?

like image 689
Slakk Avatar asked Sep 13 '16 15:09

Slakk


1 Answers

In your snippet you have

server {
    set $dn "foo.dnsalias.net";
    ...
}

However, if in your actual conf file you are missing a trailing semicolon ; after the set directive, the directive will not be terminated and text on the next line will be treated as additional arguments, which will trigger your error.

like image 118
Drakes Avatar answered Nov 15 '22 08:11

Drakes