Http://www.2cto.com/os/201302/191589.htmlnginx Load Balancer Configuration-windows Although the Nginx on Windows mentions "only as a test" in the official documentation, But for small-scale concurrent scenarios, there is a big advantage over Apache. Therefore, this article is also described as the main tool for load balancing on Windows servers. www.2cto.com Configuration instance #user nobody; #指定nginx进程数, usually consistent with the number of CPUs. Especially in Windows platforms, this value can typically be set to only 1. Worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error _log logs/error.log info; #pid logs/nginx.pid; events {# The Windows platform can only be set to 1024 Worker_connections 1024;} http { include mime.types; Default_type application/ octet-stream; #log_format main ' $remote _addr-$remote _user [$time _local] "$request" ' & nbsp # ' $status $body _bytes_sent "$http _referer" ' & nbsp # ' "$http _User_agent "" $http _x_forwarded_for "'; #access_log logs/access.log main; # If the app doesn't use file delivery, you can turn this off. www.2cto.com sendfile off; #tcp_nopush on; keepalive_timeout 15; #gzip on; # HTTPS server& nbsp Upstream cas_servers { #使用C类网络中的IP hash load offload Ip_hash ; server 127.0.0.1:8400 weight=1; Server 127.0.0.1:8401 weight =1; # Server 127.0.0.1:8402 weight=1; } server { & nbsp Listen 80; server_name 192.168.50.30; location/{ &NBS P Proxy_pass http://127.0.0.1:9000$request_uri; Proxy_Set_header Host $host; Proxy_set_header x-real-ip $remote _addr; &nbs P Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for; } } Server { Listen & nbsp 443; server_name www.example.com; SSL &NBS P on; ssl_certificate ssl.crt; # similar to Apache, Nginx does not use a password SSL key Ssl_certificate_key ssl-nokey.key ; ssl_session_timeout 5m; Ssl_protocols SSLv2 SSLv3 tlsv1; #ssl_ciphers high:!anull:! md5 Ssl_ciphers all:! Adh:! Export56:rc4+rsa:+high:+medium:+low:+sslv2:+exp; ssl_prefer_server_ciphers on; #双向认证 #ssl_client_certificate ca.crt; #双向认证 SS L_verify_client off; location/{ PROXY_PA SS http://cas_servers$request_uri; # forwards the HTTP host passed by the client to the backend Web appserver& nbsp Proxy_set_header Host $host; # deliver client-side real IP However, if the backend Web AppServer does not specifically handle this, it does not work Proxy_set_header X-real-ip $remote _ADDR;&NB Sp Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for; # If SSL is used, forward the http Ssl_cert parameter to the back-end Web appserver &NBSP ; Proxy_set_header Ssl_cert$ssl _client_cert; } } }
Nginx Load Balancer configuration-windows