Nginx. How do I reject request to unlisted ssl virtual server?
- by Osw
I have a wildcard SSL certificate and several subdomains on the same ip. Now I want my nginx to handle only mentioned server names and drop connection for others so that it'd look like nginx is not running for unlisted server names (not responding, rejecting, dead, not a single byte in response). I do the following
ssl_certificate tls/domain.crt;
ssl_certificate_key tls/domain.key;
server {
listen 1.2.3.4:443 ssl;
server_name validname.domain.com;
//
}
server {
listen 1.2.3.4:443 ssl;
server_name _;
// deny all;
// return 444;
// return 404;
//location {
// deny all;
//}
}
I've tried almost everything in the last server block, but no success. I get either valid response from known virtual server or error code. Please help.