Is this how variable (set $var) inheritance works?
Edho Arief
edho at myconan.net
Fri Feb 3 18:59:21 UTC 2012
On Sat, Feb 4, 2012 at 1:50 AM, Edho Arief <edho at myconan.net> wrote:
>> Why did I get warning for using uninitialized variables even though
>> it's not specified at all in the relevant location block?
>>
>
> After a bit more thinking, does it mean that the "alias $userfile"
> from parent location block was inherited but the $userfile was passed
> literally?
>
More self-reply: it certainly looks like the $userfile is passed but
still in variable, not expanded with the contents as the following
test showed.
Skipping "set $userfile ..." and put the capture in alias directly:
location ~ ^/~([^/]+)(|/.*)$ {
alias /home/$1/public_html/$2;
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass 127.0.0.1:9000;
}
}
resulted in this:
2012/02/03 13:51:28 [debug] 14951#0: *13 fastcgi param: "REDIRECT_STATUS: 200"
2012/02/03 13:51:28 [debug] 14951#0: *13 http script copy: "/home/"
2012/02/03 13:51:28 [debug] 14951#0: *13 http script capture: ""
2012/02/03 13:51:28 [debug] 14951#0: *13 http script copy: "/public_html/"
2012/02/03 13:51:28 [debug] 14951#0: *13 http script capture: ""
2012/02/03 13:51:28 [debug] 14951#0: *13 http script copy: "SCRIPT_FILENAME"
2012/02/03 13:51:28 [debug] 14951#0: *13 http script var: "/home//public_html/"
2012/02/03 13:51:28 [debug] 14951#0: *13 fastcgi param:
"SCRIPT_FILENAME: /home//public_html/"
2012/02/03 13:51:28 [debug] 14951#0: *13 fastcgi param: "HTTP_HOST:
yutsuki.myconan.net"
Which explains why I got "/opt/nginx/" for $request_filename on
previous config - the \.php$ location block was basically using `alias
$userfile` but as $userfile was empty, it became empty alias for that
block.
--
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
More information about the nginx
mailing list