Dynamically defining auth user file

Manlio Perillo manlio_perillo at libero.it
Tue Jan 20 02:14:04 MSK 2009


mike ha scritto:
> 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?)
> 

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

Should be easy to implement, however.


Regards  Manlio Perillo





More information about the nginx mailing list