if (!-f $request_filename){
set $rule_2 1$rule_2;
}
if (!-d $request_filename){
set $rule_2 2$rule_2;
}
if (!-e $request_filename){
set $rule_2 3$rule_2;
}
if ($request_filename !~ "-l"){
set $rule_2 4$rule_2;
}
if ($rule_2 = "4321"){
rewrite /(.+) /./index.php?path=$1 last;
}
The "set" directive isn't something essential, and actually it is just a
directive from the rewrite module.
See here how it works:
nginx.org/en/docs/http/ngx_http_rewrite_module.html
It is evaluated on the rewrite phase of request processing. Thus, if
the request is finalized before this phase, then your variable is left
uninitialized.
To debug your locations and for better understanding what is going on,
you can use nginx debug log: nginx.org/en/docs/debugging_log.html
uninitialized_variable_warn off;