: http://nginx.org/en/download.html
I am downloading the latest version (nginx/windows-1.11.10)
Decompression run Nginx.exe can see the command line window flashed past, view task Manager, you can see more than two Nginx.exe process
Enter the conf of the extracted directory
This file is the Nginx configuration file, this is the window version, some configuration has been commented out
Configuration details can see this blog http://www.cnblogs.com/sunxucool/p/3225818.html
Enter localhost to see the default page of Nginx
Now to use a Web project to achieve load balancing ...
Change configuration file
Worker_processes 1;events { worker_connections 1024;} HTTP { include mime.types; Default_type Application/octet-stream; Sendfile on ; Keepalive_timeout 65;upstream wgf.com{ #重定向的配置server localhost:8081; #负载均衡服务器1server localhost:8082; #负载均衡服务器2} Server { listen ; #监听端口 server_name localhost; #监听ip location /{#root html; #index index.html index.htm; proxy_pass http://wgf.com; #监听到的地址重定向到这个地址proxy_redirect default; } Error_page 502 503 504 /50x.html; #错误页匹配location =/50x.html { root html; }}}
This implementation of the principle can be seen from the configuration to hear localhost:80 request redirection to Nginx Pseudo-site http://wgf.com,
Then Nginx is configured to find the end-of-access server addresses localhost:8081 and localhost:8082
These two are my local two Web projects, and access to localhost rotates between the two services. The effect is as follows
Introduction to Nginx (i) Simple load balancing under window