S
S
SteepNET2019-04-29 13:47:11
Nginx
SteepNET, 2019-04-29 13:47:11

Using uninitialized NGINX in logs?

[warn] 3411#3411: *186502 using uninitialized "rule_2" variable, client: 31.148.136.163, server: site.ru, request: "GET..
There are a lot of these in the site's NGINX logs
There are such rules in the site's NGINX config

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;
}

What's wrong ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2019-04-29
@deepblack

https://forum.nginx.org/read.php?2,244722,244726#m...

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
More details:
nginx.org/en/docs/http/ngx_http_rewrite_module.htm...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question