页次: 1
nginx通过非80 proxy_pass是,比如443做代理,容易出现响应302情况,把内部代理的真实ip 响应出来,导致代理失败。
upstream apollo {
server 172.18.90.34:8070;
keepalive 320;
keepalive_time 1h;
keepalive_timeout 60s;
keepalive_requests 10000;
}
server {
listen 80;
listen 443 ssl;
server_name apollo.xxxtoon.com;
access_log /data/logs/nginx/xxxapollo.toon.com.access.log main;
error_log /data/logs/nginx/xxxapollo.toon.com.error.log;
ssl_certificate /etc/nginx/cert/server.pem;
ssl_certificate_key /etc/nginx/cert/server.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
location / {
proxy_set_header Host $http_host:$server_port; ####需要添加端口 $server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://apollo/;
proxy_redirect http://apollo.xxxtoon.com https://apollo.xxxtoon.com; ###curl -iv 能发现repose没走https,需要手工加上
}
}
最近编辑记录 小天天 (2023-04-17 13:38:51)
离线
页次: 1