示例:nginx与upserver 8011和8012都是长连接
roundrobin.conf
upstream rrups {
server 127.0.0.1:8011 weight=2 max_conns=2 max_fails=2 fail_timeout=5;
server 127.0.0.1:8012;
keepalive 32;
}
server {
server_name rrups.taohui.tech;
error_log myerror.log info;
listen 8097;
location /{
proxy_pass http://rrups;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
}
upserver.conf
server {
listen 8011;
default_type text/plain;
return 200 '8011 server response.\n';
}
server {
listen 8012;
default_type text/plain;
return 200 '8012 server response.\n';
}
测试长连接:
curl localhost:8097
图中没有看见[F.]fin包