nginx server_name inside stream block possible?

Viewed 15126

Current setup as follows:

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;

Is this possible?

$nginx -t

$nginx: [emerg] "server_name" directive is not allowed here in /etc/nginx/nginx.conf:15

Works just fine without server_name, but I'd like to use a sub-domain if possible. (I am using a build with --with-stream, thats not my issue.)

2 Answers
Related