自己简单维护了一个 需要继续改进.
user nobody; worker_processes auto; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 3600; upstream webservers { sticky; server 10.3.110.60:5200; server 10.3.110.61:5200; } server { listen 5400; server_name localhost; root /usr/share/nginx/html; proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; location / { add_header 'Access-Control-Allow-Origin' "$http_origin"; add_header 'Access-Control-Allow-Credentials' "true"; proxy_pass http://webservers; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }