What problem does SNI solve?
HTTPS encrypts the connection before any HTTP headers are sent. Without extra help, the server would not know which site the visitor wants until after it had already picked a certificate, so every HTTPS site needed its own IP address. SNI fixes that by putting the requested host name in the first message of the TLS handshake, the ClientHello. The server reads it, chooses the matching certificate and completes the handshake. Today every browser, phone, command-line tool and modern library sends SNI, which is why one public IPv4 address can carry HTTPS for dozens or hundreds of domains.
Why does that matter on a dedicated server?
Each of our machines comes with one public IPv4 address, and additional addresses are not offered. SNI is what makes that a non-issue for web hosting: put as many sites as you like on the box, each with its own certificate, all on port 443 of the same address. Reverse proxies route by the same name, so containers and apps behind nginx also share the one address; see nginx reverse proxy in Docker.
How does nginx use SNI?
nginx matches the SNI name against the server_name of each server block listening on 443 and uses that block's ssl_certificate. If no block matches, it falls back to the default server for that address and port, which is the first one defined or the one marked default_server. A clean pattern is a catch-all default that refuses unknown names instead of showing some other site's certificate:
server {
listen 443 ssl default_server;
ssl_reject_handshake on;
}
ssl_reject_handshake (nginx 1.19.4 and newer) ends handshakes for names you do not host, so scanners that connect by bare IP get nothing useful. Ubuntu 22.04 and 24.04 both ship a version that supports it.
How do I test SNI?
With openssl s_client, the -servername option sets the SNI value, which lets you check each site on the box independently of DNS:
openssl s_client -connect 203.0.113.20:443 -servername docs.example.org -brief </dev/null openssl s_client -connect 203.0.113.20:443 -servername docs.example.org </dev/null 2>/dev/null | openssl x509 -noout -subject -ext subjectAltName
The first prints the protocol, cipher and verification result; the second shows the certificate's names. curl does the same from the HTTP side with --resolve, which keeps SNI and the Host header correct while connecting to a chosen IP; curl and certificate errors has more certificate checks.
What goes wrong with SNI?
| Symptom | Likely cause | Fix |
|---|---|---|
| Browser shows another site's certificate | No server block matches the name, so the default answered | Add the name to server_name, or add a rejecting default |
| Works in the browser, fails in a script | Client connects by IP without setting SNI | Connect by host name, or set SNI explicitly in the client |
| Health checker reports wrong certificate | Checker does not send SNI | Enable SNI in the checker, or point it at the default site |
| Proxy to an HTTPS backend fails | nginx does not send SNI upstream by default | Add proxy_ssl_server_name on; |
The last one surprises many people: when nginx proxies to an HTTPS upstream that itself hosts several names, add proxy_ssl_server_name on; and, if needed, proxy_ssl_name to choose which name to send.
Is SNI private?
In classic TLS, SNI travels unencrypted, so anyone watching the network can see which host name a client requested, even though the rest of the session is encrypted. Encrypted Client Hello (ECH) addresses that by encrypting the ClientHello with a key published in DNS. Browser support exists and server support is growing, but it is not yet a standard part of most self-hosted stacks. For now, assume the host name is visible on the wire.
Does SNI apply to anything besides websites?
Yes, any TLS service can use it: mail servers on 465 and 993 can present per-domain certificates, and TLS-aware proxies such as HAProxy can route raw TCP by SNI without decrypting, using req.ssl_sni. That lets one port 443 carry both a web server and, for example, a different TLS service, chosen by name. Certificates for each name are free from Let's Encrypt; see Let's Encrypt with nginx.
Machines for Many HTTPS Sites on One IP
| Server | Processor | Cores / threads | Memory | Storage | Network | Per month | Smallest order |
|---|---|---|---|---|---|---|---|
| E1 | Intel Xeon E3-1240 v3 | 4 / 8 | 16 GB DDR3 | 2x 240 GB SSD | 2x 1 Gbps | $30.52 | $91.56 (3 months) |
| E2 | Intel Xeon E3-1270 v3 | 4 / 8 | 32 GB DDR3 | 1x 480 GB SSD | 2x 1 Gbps | $38.32 | $114.96 (3 months) |
| S1 | Intel Xeon E-2276G | 6 / 12 | 64 GB DDR4 | 1x 1 TB NVMe | 2x 10 Gbps | $53.32 | $53.32 (1 month) |
| S2 | Intel Xeon E-2356G | 6 / 12 | 64 GB DDR4 | 1x 1 TB NVMe | 2x 10 Gbps | $58.39 | $58.39 (1 month) |
Keep Reading
Let's Encrypt with nginx
Get free TLS certificates for nginx with certbot, choose the nginx or webroot method, and confirm automatic renewal works.
OpenIPv4 on a /31
Why each machine gets one public IPv4 on a /31 network, how the two addresses split between gateway and server, and how to configure it.
OpenSSH vs SSL/TLS
Both encrypt traffic, but SSH runs your admin sessions while TLS protects websites and APIs; here is where each fits.
OpenWeb server
Both meanings of web server, the software that speaks HTTP and the machine that runs it, plus what limits how many visitors one box serves.
OpenFAQ
Quick Answers
No. With SNI, which every modern client supports, one IPv4 address can serve many HTTPS sites with separate certificates.
It matches the SNI name against server_name in the 443 server blocks. With no match, the default server for that port answers.
Run openssl s_client -connect IP:443 -servername host.example and read the certificate subject and names.
Not in classic TLS. Encrypted Client Hello hides it, but support in self-hosted servers is still limited.
It does not send SNI upstream by default. Add proxy_ssl_server_name on; to the location.