现在主机上的 80 和 443 端口被占用,所以我部署的一个Nginx Proxy Manager
只能使用 8080 和 8443 ,现在想要把指定域名的流量转到 8080 和 8443
我添加的 nginx 配置
server { listen 80; listen [::]:80; server_name nas.example.com *.nas.example.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:8080; } } server { listen 443 ssl; listen [::]:443 ssl; server_name nas.example.com *.nas.example.com; location / { proxy_pass https://127.0.0.1:8443; proxy_ssl_name $host; proxy_ssl_server_name on; } }
现在 80 端口转发是正常的,但 443 端口总是返回 502 ,报错信息
2024/10/31 22:17:43 [error] 3401182#3401182: *120377 upstream prematurely closed connection while reading response header from upstream, client: 192.168.31.8, server: nas.exmaple.com, request: "GET / HTTP/1.1", upstream: "https://127.0.0.1:8443/", host: "dns.nas.exmaple.com"
我知道 stream+ssl_preread 应该可以实现这个功能,但侵入性太大,想问一下有没有其它的方式
1 leyoumake1997 350 天前 |
![]() | 2 Actrace 349 天前 nginx 可以设置 upstream 不验证 SSL ,这样你就可以使用自签证书来做对接。 不过,既然你用了 UI ,那么难免会受限于 UI 能做到的事情,直接编写配置文件会比较好。 |
3 CodeCodeStudy 349 天前 在 443 端口那里 proxy_pass http://127.0.0.1:8080; 这样不就行了吗 |
4 kur0d3s 349 天前 直接 stream 模块转发 tcp 或者直接 dnat ? |