upstream servers { ip_hash; #hash,ip轮训 server localhost:8400; } server { listen 80; server_name localhost; #这里可以配置多个ip #charset koi8-r; #access_log logs/access.log main; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://servers; proxy_redirect off; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }