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: