@SteepNET

Using uninitialized NGINX в логах?

[warn] 3411#3411: *186502 using uninitialized "rule_2" variable, client: 31.148.136.163, server: site.ru, request: "GET..
Такого очень много в логах NGINX сайта

В конфиге NGINX сайта есть такие правила

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


Что не так ?
  • Вопрос задан
  • 1060 просмотров
Пригласить эксперта
Ответы на вопрос 1
deepblack
@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


UPD: Если все отрабатывает исправно, то можете установить
uninitialized_variable_warn off;

Подробнее:
nginx.org/en/docs/http/ngx_http_rewrite_module.htm...
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы