Glossary

Server Name Indication (SNI)

Server Name Indication is a TLS extension in which the client names the host it wants at the very start of the handshake, so the server can present the right certificate.

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?

SymptomLikely causeFix
Browser shows another site's certificateNo server block matches the name, so the default answeredAdd the name to server_name, or add a rejecting default
Works in the browser, fails in a scriptClient connects by IP without setting SNIConnect by host name, or set SNI explicitly in the client
Health checker reports wrong certificateChecker does not send SNIEnable SNI in the checker, or point it at the default site
Proxy to an HTTPS backend failsnginx does not send SNI upstream by defaultAdd 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

ServerProcessorCores / threadsMemoryStorageNetworkPer monthSmallest order
E1Intel Xeon E3-1240 v34 / 816 GB DDR32x 240 GB SSD2x 1 Gbps$30.52$91.56 (3 months)
E2Intel Xeon E3-1270 v34 / 832 GB DDR31x 480 GB SSD2x 1 Gbps$38.32$114.96 (3 months)
S1Intel Xeon E-2276G6 / 1264 GB DDR41x 1 TB NVMe2x 10 Gbps$53.32$53.32 (1 month)
S2Intel Xeon E-2356G6 / 1264 GB DDR41x 1 TB NVMe2x 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.

Open

IPv4 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.

Open

SSH vs SSL/TLS

Both encrypt traffic, but SSH runs your admin sessions while TLS protects websites and APIs; here is where each fits.

Open

Web 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.

Open

FAQ

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.