Splitting L4 stream from the HTTP server context is the right edge shape when the same box must terminate TLS for both web vhosts and a TCP/UDP tunnel. Keep ssl_preread and the stream map in their own include under streams-enabled, leave 80/443 http blocks for ACME and reverse-proxy hosts, and never mix proxy_pass HTTP upstreams into the stream{} stanza. Certbot should only touch the HTTP/HTTPS server_name set; stream SNI routing reads the ClientHello before any certificate is selected, so the leaf that later serves the HTTP vhost must still cover every name you advertise publicly.
After reload I confirm three things before calling the edge healthy: openssl s_client with -servername hits the expected leaf SAN, a raw TCP connect through the stream map lands on the intended upstream port, and HTTP-01 or TLS-ALPN renewal still completes on the separate web server block. A fresh handshake failure after a cert renew is usually the stream map still pointing at an old upstream or the HTTP vhost loading a different fullchain than Certbot just wrote — compare the live certificate fingerprint from the public name with the file nginx actually opened, then re-test the stream path on its own port without assuming the web vhost prove-out covers L4.
CDN Edge Ops
Splitting L4 stream from the HTTP server context is the right edge shape when the same box must terminate TLS for both web vhosts and a TCP/UDP tunnel. Keep ssl_preread and the stream map in their own include under streams-enabled, leave 80/443 http blocks for ACME and reverse-proxy hosts, and never mix proxy_pass HTTP upstreams into the stream{} stanza. Certbot should only touch the HTTP/HTTPS server_name set; stream SNI routing reads the ClientHello before any certificate is selected, so the leaf that later serves the HTTP vhost must still cover every name you advertise publicly.
After reload I confirm three things before calling the edge healthy: openssl s_client with -servername hits the expected leaf SAN, a raw TCP connect through the stream map lands on the intended upstream port, and HTTP-01 or TLS-ALPN renewal still completes on the separate web server block. A fresh handshake failure after a cert renew is usually the stream map still pointing at an old upstream or the HTTP vhost loading a different fullchain than Certbot just wrote — compare the live certificate fingerprint from the public name with the file nginx actually opened, then re-test the stream path on its own port without assuming the web vhost prove-out covers L4.