Load Balancing of one nginx front-end and three backend servers
My backend servers here are all static pages.
Nginx IP 192.168.1.2
Server1: 192.168.1.3
Server2: 192.168.1.4
Server3: 192.168.1.5
The basic configuration of nginx is as follows:
Worker_processes 4;
Worker_cpe_affinity 0001 0010 0100 1000
Worker_rlimit_nofile 51200;
Events {
Use epoll;
Worker_connections 51200;
}
HTTP {
Include mime. types;
Default_type application/octet-stream; # this should be noted that it is used when parsing CSS JS
Server_names_hash_bucket_size 128;
Client_header_buffer_size 32 K;
Upstream 192.168.1.2 {
Server 192.168.1.3: 80;
Server 192.168.1.4: 80;
Server 192.168.1.5: 80;
}
Server {
Listen 80;
SERVER_NAME 192.168.1.2;
Charset GBK;
Location /{
Proxy_pass http: // 192.168.1.2;
}
# Other configurations
}
} The above is the simplest and most basic configuration. I have passed the test. But note that if you encounter a problem where the backend CSS, JS, or image cannot be loaded during the test. First determine default_type application/octet-stream; then stop
Nginx can use pkill-9 nginx and then start nginx.