nginx server_name 内部流块可能吗?
nginx server_name inside stream block possible?
当前设置如下:
stream {
server {
listen 9987 udp;
server_name subdomain.EXAMPLE.com; # this line is resulting in an error
proxy_pass localhost:9987;
proxy_timeout 1s;
proxy_responses 1;
error_log logs/dns.log;
}
}
server_name subdomain.EXAMPLE.com;
这可能吗?
$nginx -t
$nginx: [emerg] "server_name" directive is not allowed here in /etc/nginx/nginx.conf:15
没有 server_name 也能正常工作,但我想尽可能使用子域。 (我正在使用 --with-stream 构建,这不是我的问题。)
TCP has no concept of server names, so this is not possible. It only works
in HTTP because the client sends the hostname it is trying to access as
part of the request, allowing nginx to match it to a specific server block.
来源:https://forum.nginx.org/read.php?2,263208,263217#msg-263217
当前设置如下:
stream {
server {
listen 9987 udp;
server_name subdomain.EXAMPLE.com; # this line is resulting in an error
proxy_pass localhost:9987;
proxy_timeout 1s;
proxy_responses 1;
error_log logs/dns.log;
}
}
server_name subdomain.EXAMPLE.com;
这可能吗?
$nginx -t
$nginx: [emerg] "server_name" directive is not allowed here in /etc/nginx/nginx.conf:15
没有 server_name 也能正常工作,但我想尽可能使用子域。 (我正在使用 --with-stream 构建,这不是我的问题。)
TCP has no concept of server names, so this is not possible. It only works in HTTP because the client sends the hostname it is trying to access as part of the request, allowing nginx to match it to a specific server block.
来源:https://forum.nginx.org/read.php?2,263208,263217#msg-263217