[0.8.50] Bug in if?
Marcin "WMP" Janowski
janowski.m at gmail.com
Wed Sep 22 12:36:59 MSD 2010
2010/9/22 Maxim Dounin <mdounin at mdounin.ru>:
> Hello!
>
> On Tue, Sep 21, 2010 at 11:57:33PM +0200, Marcin WMP Janowski wrote:
>
> [...]
>
>> and it works as expected. Now, I tried to separate users' access (so
>> that any given user had access only to his directory) with the if
>> statements:
>>
>> location ~ ^/(.+?)/download(/.*) {
>> auth_basic "Restricted";
>> auth_basic_user_file /etc/nginx/htpasswd;
>> alias /home/$1/download$2;
>> autoindex on;
>> include mime.types;
>> types { }
>> default_type application/octet-stream;
>> if ($remote_user != '') { set $hack b; }
>> if ($remote_user != $1) { set $hack a$hack; }
>> if ($hack = ab) { return 403; }
>> }
>>
>> That caused 404 errors. This is the relevant fragment of the error log:
>>
>> 2010/09/21 23:12:41 [error] 31813#0: *245 "/home/wmp/download/.1
>> Hostindex.html" is not found (2: No such file or directory), client:
>> 87.205.146.217, server: domain, request: "GET /wmp/download/
>> HTTP/1.1", host: "domain:9900"
>
> http://wiki.nginx.org/IfIsEvil
>
> See if-and-alias example.
Ok, i do:
location ~ ^/(?<user>.+?)/download(?<file>/.*) {
alias /home/$user/rtorrent/download$file;
but down work, i have this same error.
--
Marcin Janowski(WMP)
More information about the nginx
mailing list