Opened 11 years ago

Closed 11 years ago

#387 closed defect (invalid)

auth_basic_user_file is relative not from prefix given by -p key

Reported by: Тарас Буник Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.2.x
Keywords: auth-basic Cc:
uname -a: Linux lubuntuk 3.8.0-26-generic #38-Ubuntu SMP Mon Jun 17 21:43:33 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.2.6 (Ubuntu)
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --with-pcre-jit --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/build/buildd/nginx-1.2.6/debian/modules/nginx-auth-pam --add-module=/build/buildd/nginx-1.2.6/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.2.6/debian/modules/nginx-upstream-fair --add-module=/build/buildd/nginx-1.2.6/debian/modules/nginx-dav-ext-module

Description

I have following in config:

    location /supervisor/ {
        proxy_pass http://localhost:9001;
        proxy_redirect off;
        auth_basic "please log in";
        auth_basic_user_file ./htpasswd;
    }

I start nginx like this: sudo nginx -p /home/user/project/

htpasswd lies at /home/user/project/htpasswd

But in nginx error log I see this:

2013/07/24 17:47:43 [error] 5912#0: *20 no user/password was provided for basic authentication, client: 127.0.0.1, server: _, request: "GET /supervisor/ HTTP/1.1", host: "localhost:3306"
2013/07/24 17:47:43 [error] 5912#0: *20 open() "/etc/nginx/./htpasswd" failed (2: No such file or directory), client: 127.0.0.1, server: _, request: "GET /supervisor/ HTTP/1.1", host: "localhost:3306"
2013/07/24 17:48:18 [error] 5912#0: *21 no user/password was provided for basic authentication, client: 127.0.0.1, server: _, request: "GET /supervisor/ HTTP/1.1", host: "localhost:3306"
2013/07/24 17:48:18 [error] 5912#0: *21 open() "/etc/nginx/./htpasswd" failed (2: No such file or directory), client: 127.0.0.1, server: _, request: "GET /supervisor/ HTTP/1.1", host: "localhost:3306"

Change History (2)

comment:1 by Тарас Буник, 11 years ago

Ok, I not noticed that

Since version 0.6.7 the filename path is relative to directory of nginx configuration file nginx.conf, but not to nginx prefix directory.

So you could close this as not a bug.

comment:2 by Maxim Dounin, 11 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.