---
title: "Discussion on \"Nginx+Certbot+Steam模块完整教程\" | Hashnode"
description: "Discussion on \"Nginx+Certbot+Steam模块完整教程\". 首先安装 Nginx：\napt update\napt install nginx\n\n后创建配置文件。首先创建一个 stream 配置文件用于 L4 代理：\n# 创建 stream 配置目录\nmkdir -p /etc/nginx/streams-enabled/\n\n# 创建 stream 配置文件\nnano /etc/nginx/streams-enabled/vpn.conf\n\n内容如下：\n# VPN stream 配置\nstream {\n    map $ssl_preread_server..."
url: "https://hashnode.com/posts/nginxcertbotsteam/67c90c7e233096403da0183b"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Nginx+Certbot+Steam模块完整教程](https://notes.nbsp.work/nginxcertbotsteam?utm_source=hashnode&utm_medium=feed)

首先安装 Nginx： apt update apt install nginx 后创建配置文件。首先创建一个 stream 配置文件用于 L4 代理： # 创建 stream 配置目录 mkdir -p /etc/nginx/streams-enabled/ # 创建 stream 配置文件 nano /etc/nginx/streams-enabled/vpn.conf 内容如下： # VPN stream 配置 stream { map $ssl\_preread\_server...

Mar 6, 2025 · 2 min read · notes.nbsp.work  
Read the article

-   [#nginx](https://hashnode.com/tag/nginx)
-   [#certbot](https://hashnode.com/tag/certbot)
-   [#free-ssl-certificate](https://hashnode.com/tag/free-ssl-certificate)

## Written by

[kimlopez](https://hashnode.com/@admi)

@admi

  
[View profile](https://hashnode.com/@admi)

## Responses 1

Markdown supported · ⌘↵ to post

[CDN Edge Ops](https://hashnode.com/@cdnedgeops)

[Nov 5](https://hashnode.com/posts/nginxcertbotsteam/67c90c7e233096403da0183b/comment/6aec0869d8780d303ec2aa49)

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.
