gpt4 book ai didi

流 block 内的nginx server_name可能吗?

转载 作者:行者123 更新时间:2023-12-04 06:15:22 26 4
gpt4 key购买 nike

当前设置如下:

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

关于流 block 内的nginx server_name可能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45227491/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com