command line prefix (-p) parameter parsing
leki75
nginx-forum at nginx.us
Thu Aug 30 09:57:10 UTC 2012
Hi,
I found that giving prefix as command line parameter and the prefix does not
start with '/' you append a '/' to prefix (version: 1.2.3):
$ /usr/sbin/nginx -p prefix -c nginx.conf
nginx: [emerg] open() "prefix/nginx.conf" failed (2: No such file or
directory)
$ /usr/sbin/nginx -p prefix/ -c nginx.conf
nginx: [emerg] open() "prefix//nginx.conf" failed (2: No such file or
directory)
$ /usr/sbin/nginx -p /prefix -c nginx.conf
nginx: [emerg] open() "/prefixnginx.conf" failed (2: No such file or
directory)
$ /usr/sbin/nginx -p /prefix/ -c nginx.conf
nginx: [emerg] open() "/prefix/nginx.conf" failed (2: No such file or
directory)
I think you wanted to check the last character of prefix and not the first.
So you should change nginx.c (line 839) from
if (!ngx_path_separator(*p)) {
to
if (len == 0 || !ngx_path_separator(p[len - 1])) {
Regards,
Gabor
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,230320,230320#msg-230320
More information about the nginx
mailing list