Bug in the nginx-0.7.xx include .../conf.d/*.conf process ?
Maxim Dounin
mdounin at mdounin.ru
Sun Mar 22 20:27:26 MSK 2009
Hello!
On Sun, Mar 22, 2009 at 12:07:42PM +0000, Mark Alan wrote:
> In Debian/Ubuntu systems (also in .rpm based systems?) /conf.d/*.conf
> files are used to (automatically) supersede any configuration originally
> put in the main .conf file (nginx.conf) by the program
> developers/maintainers.
>
> In the file /etc/nginx/nginx.conf (or
> /usr/local/nginx/conf/nginx.conf, if installed from source) there is
> supposed to that, loading alternative config files: include
> /etc/nginx/conf.d/*.conf;
>
> In nginx-0.7.43 creating a file at .../conf.d/my_own.conf with the
> contents:
> keepalive_timeout 10 10;
> gzip on;
> gzip_types text/plain text/css application/x-javascript text/xml
> application/xml application/xml+rss text/javascript;
> gzip_min_length 640;
>
> Will lead, when trying to restart nginx, to a nginx halt with an error
> message like:
> " [emerg] 9242#0: "keepalive_timeout" directive is duplicate in
> /etc/nginx/conf.d/server_specific_parameters.conf:1
> "
>
> In the absence of a better opinion, it seems that it would make more
> sense if, instead, the new values superseed any already existant
> parameters in nginx.conf and nginx give the user a warning message
> listing the parameters being superseeded.
> Ideally any 20-my_own.conf file would be read after and superseed any
> values in a 10-my_own.conf file, wich in turn would be read after and
> superseed any values in nginx.conf
>
> Regarding any new parameters not present in any previous *.conf, nginx
> would simply read and add them without any further warning.
This is not bug, it's by design. And this allows to catch obvious
configuration errors easily - without even breaking working setup,
since nginx master process will refuse to reload configuration
with bugs (and hence old worker processes with correct
configuration will continue to serve requests).
Also I should say that debian default config layout for nginx is
rather bad, since it provokes many configuration bugs. Some of
them are easy to find thanks to duplication checks, but some are
really hard to find.
Maxim Dounin
More information about the nginx
mailing list