Nginx 反向代理动态站点 不同路径不同端口 显示空白页
- 0次
- 2021-05-19 22:32:12
- idczone
如题,被代理的后端服务器是 Jetty
访问时,浏览器中显示空白页,页面标题可正常显示,查看源代码也是有内容的。
这和因为被代理的是动态站或者 https 有关系吗?
关键配置如下:
upstream site{
server localhost:80;
}
upstream site2{
server localhost:8080;
}
upstream site3{
server localhost:8090;
}
server {
listen 8100 ssl http2;
listen [::]:8100 ssl http2;
server_name example.com;
access_log logs/access.log;
ssl_certificate ./conf/ssl/example.com/example.com.crt;
ssl_certificate_key ./conf/ssl/example.com/example.com.key;
s国外服务器sl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location /site {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Remote_addr $remote_addr;
proxy_pass http://site/;
}
location /site2 {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Remote_addr $remote_addr;
proxy_pass http://site2/;
}
location /site3 {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Remote_addr $remote_addr;
proxy_pass http://site3/;
}
}