嘟嘟社区

[nginx] 咨询nginx 反代https源站的问题


菜鸟求助,nginx 反代 https://AAA.com,开始正常,跳转https://AAA.com/bbs/index.php 出现问题,只显示网页底色,如果直接反代 http://AAA.com 则完全正常。

看错误代码

[error] 5790#5790: *15933 upstream prematurely closed connection while reading upstream, client: 127.0.0.1, server: m.shss.pw, request: "GET /bbs/index.php HTTP/2.0", upstream: "https://数字 IP:443/bbs/index.php", host: "BBB.com", referrer: "https:/BBB.com/"

https://AAA.com 是可以打开的,但是 https://数字 IP:443/ 显然是无法打开的,数字IP为AAA.com 解析ip。

请问这种情形下 nginx 如何修改配置?

贴一下配置:
server {
listen 443 ssl http2;
server_name BBB.com;
ssl_certificate cert/XXX.crt;
ssl_certificate_key cert/XXX.key;
resolver 1.1.1.1 valid=3600s;
resolver_timeout 3s;
set $backend https://AAA.com;
add_header Strict-Transport-Security "max-age=31536000;includeSubDomains" always;

location / {
proxy_redirect off;
proxy_pass $backend;
proxy_ssl_server_name on;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host AAA.com;
proxy_set_header Accept-Encoding "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Referer https://AAA.com;
}
}

没看懂