Dynamically defining auth user file

mike mike503 at gmail.com
Mon Jan 19 10:08:46 MSK 2009


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?)





More information about the nginx mailing list