How to escape the value of nginx fastcgi_param

I need to configure the password of the database through fastcgi_param

fastcgi_param DB_PASS "afdas$madads"

here $m is part of the password, but nginx always treats it as a variable, and adding a backslash doesn"t work either. What to do with it, guys

Jan.25,2022

change password


this has not been done. The project has tried to put it in the env in php-fpm.conf, for example, Env [DB _ PASS] = XXX


searched the Internet again and found the answer. It turns out that nginx does not support the escape of this $, but there is a way to get around this problem. You only need to define it as follows before the server block:

geo $m {
    default "$m";
}
For more information, please see https://www.jianshu.com/p/446.

.
Menu