流的动态 proxy_pass
Dynamic proxy_pass for stream
我正在尝试让 openresty 使用 lua 动态反向代理 TCP。
首先,我有:
stream {
server {
listen 9291;
set_by_lua_block $proxy '
ngx.var.proxy = "10.128.128.3:8291"
';
proxy_pass $proxy;
}
}
但是 openresty -t 说:
nginx: [emerg] "set_by_lua_block" directive is not allowed here in /usr/local/openresty/nginx/conf/nginx.conf:129
我找到了很多关于动态 proxy_pass 的文档,但都是针对 'http'。
看看 balancer_by_lua_block 指令。
您需要在 balancer_by_lua_block.
中使用 ngx.balancer API
仔细阅读所有文档。有很多聪明的细节。
但你需要的都在这里,只有 RTFM。
我正在尝试让 openresty 使用 lua 动态反向代理 TCP。
首先,我有:
stream {
server {
listen 9291;
set_by_lua_block $proxy '
ngx.var.proxy = "10.128.128.3:8291"
';
proxy_pass $proxy;
}
}
但是 openresty -t 说:
nginx: [emerg] "set_by_lua_block" directive is not allowed here in /usr/local/openresty/nginx/conf/nginx.conf:129
我找到了很多关于动态 proxy_pass 的文档,但都是针对 'http'。
看看 balancer_by_lua_block 指令。 您需要在 balancer_by_lua_block.
中使用 ngx.balancer API仔细阅读所有文档。有很多聪明的细节。 但你需要的都在这里,只有 RTFM。