Forum: NGINX Dynamically defining auth user file

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
mike (Guest)
on 2009-01-19 09:20
(Received via mailing list)
i have this snippet

if ($request_uri ~* "/foo/(.+)/") {
   set $htpasswd /home/foo/$1/.htpasswd;
}
auth_basic "Restricted files";
auth_basic_user_file $htpasswd;

this shows in the error log:

009/01/18 23:07:49 [crit] 11167#0: *2670248 open()
"/etc/nginx/$htpasswd" failed (2: No such file or directory), client:
1.2.3.4, server: foo.com, request: "GET /9389fd09fsd/ HTTP/1.1", host:
"foo.com"

is there a way to make this work with variables? or is that
impossible? (any other ideas, as well?)
Manlio P. (Guest)
on 2009-01-20 01:23
(Received via mailing list)
mike ha scritto:
> 009/01/18 23:07:49 [crit] 11167#0: *2670248 open()
> "/etc/nginx/$htpasswd" failed (2: No such file or directory), client:
> 1.2.3.4, server: foo.com, request: "GET /9389fd09fsd/ HTTP/1.1", host:
> "foo.com"
>
> is there a way to make this work with variables? or is that
> impossible? (any other ideas, as well?)
>

The auth_basic module does not support variables in the use_file
directive.

Should be easy to implement, however.


Regards  Manlio P.
This topic is locked and can not be replied to.