目前的设置如下:

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

标签: nginx, proxy, stream, reverse

相关文章推荐

添加新评论,含*的栏目为必填