# Default ssl server and sni

**URL:** <https://www.ruby-forum.com/t/default-ssl-server-and-sni/233490>\
**Category:** NGINX\
**Created:** [December 17, 2014, 6:07pm UTC](https://www.ruby-forum.com/t/default-ssl-server-and-sni/233490 "2014-12-17T18:07:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [December 17, 2014, 6:07pm UTC](https://www.ruby-forum.com/t/default-ssl-server-and-sni/233490/1 "2014-12-17T18:07:26Z")

</div>

I have a bunch of https websites available over a single IP working with  
sni  
on nginx 1.0.15.

Currently, anyone accessing a domain name that resolves to the same IP  
is  
greeted with a certificate mismatch error due to nginx choosing the  
first  
server as the default.

Instead of using the first server as the default, I’d like to create a  
catch-all https server that drops/resets the tcp connection. As such all  
domain names that have an associated server block would still work using  
sni, but IPs or other domain names would simply result in a dropped  
connection.

Unfortunately, I can’t seem to get this to work. If I define the server  
block below, all requests are handled by the catch-all server, and all  
the  
websites become inaccessible. Here is the server block I’ve defined:

server {  
listen 443 default\_server;  
return 443;  
}

Does anyone know how I could achieve this?

Thanks!

Arthur

Posted at Nginx Forum:

> **[Default ssl server and sni](https://forum.nginx.org/read.php?2,255583,255583#msg-255583)**
>
> I have a bunch of https websites available over a single IP working with sni on nginx 1.0.15. Currently, anyone accessing a domain name that resolves to the same IP is greeted with a certificate mismatch error due to nginx choosing the first server...
