nginx的stream模块转发配置

upstream xaio443 {
  server 172.16.0.103:443;
  server 172.16.0.104:443;
}

upstream xaio80 {
  server 172.16.0.103:80;
  server 172.16.0.104:80;
}

log_format proxy '$proxy_protocol_addr $remote_addr [$time_local] '
    '$protocol $status $bytes_sent $bytes_received '
    '$session_time "$upstream_addr" '
    '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';

server {
  listen 443;
  ssl_preread on;
  proxy_connect_timeout 1s;
  proxy_timeout 3s;
  proxy_pass xaio443;


  access_log /data/logs/access443.log proxy;
  error_log /data/logs/error443.log info;
}

server {
  listen 80;
  proxy_connect_timeout 1s;
  proxy_timeout 3s;
  proxy_pass xaio80;


  access_log /data/logs/access80.log proxy;
  error_log /data/logs/error80.log info;
}