NGINX lua使用来自env var的安全链接md5
我正在使用支持lua的NGINX从.env文件访问主机名和其他与应用程序相关的变量。 现在我想使用.env文件中的secure_link_md5变量,但我不知道如何组合字符串以便nginx能够理解它 这就是我的nginx配置的样子:NGINX lua使用来自env var的安全链接md5,nginx,lua,environment-variables,Nginx,Lua,Environment Variables,我正在使用支持lua的NGINX从.env文件访问主机名和其他与应用程序相关的变量。 现在我想使用.env文件中的secure_link_md5变量,但我不知道如何组合字符串以便nginx能够理解它 这就是我的nginx配置的样子: env LINK_SECRET; set_by_lua $curr_dl_link_secret 'return os.getenv("LINK_SECRET")'; # Needs to be set correctly secure_link_md5 = "$
env LINK_SECRET;
set_by_lua $curr_dl_link_secret 'return os.getenv("LINK_SECRET")'; # Needs to be set correctly
secure_link_md5 = "${curr_dl_link_secret}$uri$secure_link_expires";
通常我会这样设置配置行,而不使用lua和env变量:
secure_link_md5 "XGc7YyXERjiSvs4PtzpnBMANuFd22VAmXDc66g6JU$uri$secure_link_expires";
当前NGINX始终返回以下错误:
“安全链接”md5中的参数数无效
NGINX将“=”计为参数。我不熟悉使用lua的NGINX,但我认为“{}”也是不必要的
我猜你想要这样的东西:
secure_link_md5 "$curr_dl_link_secret$uri$secure_link_expires";