Opened 7 years ago

Closed 6 years ago

#1524 closed defect (worksforme)

Nginx accept config with unknown directive

Reported by: den.efremov@… Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.12.x
Keywords: Cc:
uname -a: Linux lb-02 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux
nginx -V: nginx/1.12.2

Description

root@lb-02:/etc/nginx# cat nginx.conf | grep include && nginx -t
  include       /etc/nginx/mime.types;
  not_include /etc/nginx/conf.d/*.conf;
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Package from official nginx repository:

root@lb-02:/etc/nginx# cat /etc/apt/sources.list.d/nginx.list 
deb https://nginx.org/packages/debian/ stretch nginx

On other server all OK:

root@web-06:/etc/nginx# nginx -v && uname -a && cat /etc/apt/sources.list.d/nginx.list 
nginx version: nginx/1.12.2
Linux web-06 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux
deb https://nginx.org/packages/debian/ stretch nginx

root@web-06:/etc/nginx# cat nginx.conf | grep include && nginx -t
    include       /etc/nginx/mime.types;
    not_include /etc/nginx/conf.d/*.conf;
nginx: [emerg] unknown directive "not_include" in /etc/nginx/nginx.conf:31
nginx: configuration file /etc/nginx/nginx.conf test failed

Attachments (1)

lb-02-dpkg.log (61.7 KB ) - added by den.efremov@… 7 years ago.
List of installed packages

Download all attachments as: .zip

Change History (4)

by den.efremov@…, 7 years ago

Attachment: lb-02-dpkg.log added

List of installed packages

comment:1 by Andrei Belov, 7 years ago

Did you make any changes to /etc/nginx/mime.types on lb-02? Could you please share that file?

comment:2 by Maxim Dounin, 7 years ago

In nginx configuration, directives are not required to start and end with new lines. As such, the provided information is not enough to conclude that not_include ... in the grep provided is interpreted as a directive. For example, in the following configuration it will be interpreted as an index file name:

index index.html
not_include /etc/nginx/conf.d/*.conf;

Note no ; after the first line, so both not_include and /etc/nginx/conf.d/*.conf are interpreted as parameters of the index directive.

If you think there is indeed a bug, and not a misconfiguration as explained above, please provide full nginx -T output.

comment:3 by Maxim Dounin, 6 years ago

Resolution: worksforme
Status: newclosed

Feedback timeout.

Note: See TracTickets for help on using tickets.