我试图在 Nginx 中的 http 指令中映射一个变量。
当单独存在时,变量单独被扩展,如果我向字符串添加任何其他内容,扩展将停止工作。
http {
map $host $foo {
#default "$host"; # - this works fine and returns 'localhost'
default "This is my host: $host"; # - THIS DOESN'T WORK
}
server {
location / {
echo $foo;
}
}
}
Run Code Online (Sandbox Code Playgroud)
您有什么建议可以使地图内的扩展工作吗?
nginx ×1