现在主机上的 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 应该可以实现这个功能,但侵入性太大,想问一下有没有其它的方式
|