lb01停掉
[root@lb01 conf]# pkill nginx
lb02配置如同01,然后启动
[root@lb02 ~]# vim /application/nginx/conf/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream www_server_pools {
server 10.0.0.7:80 weight=1;
server 10.0.0.8:80 weight=1;
}
server {
listen 80;
server_name www.etiantian.org;
location / {
root html;
index index.html index.htm;
proxy_pass http://www_server_pools;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
}
~
~
~
~
~
~
[root@lb02 ~]# /application/nginx/sbin/nginx -t
nginx: the configuration file /application/nginx-1.6.3/conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.6.3/conf/nginx.conf test is successful
[root@lb02 ~]# /application/nginx/sbin/nginx
[root@lb02 ~]#
web02操作
[root@web02 /]# for n in `seq 100`; do curl 172.16.1.6/index.html;sleep 1;done
...
10.0.0.5 - - [23/Feb/2020:00:50:11 +0800] "GET /index.html HTTP/1.0" 200 11
10.0.0.5 - - [23/Feb/2020:00:50:13 +0800] "GET /index.html HTTP/1.0" 200 11
10.0.0.5 - - [23/Feb/2020:00:53:31 +0800] "GET /index.html HTTP/1.0" 200 11
10.0.0.5 - - [23/Feb/2020:00:53:33 +0800] "GET /index.html HTTP/1.0" 200 11
10.0.0.5 - - [23/Feb/2020:00:53:35 +0800] "GET /index.html HTTP/1.0" 200 11
10.0.0.6 - - [23/Feb/2020:01:13:48 +0800] "GET /index.html HTTP/1.0" 200 11
10.0.0.6 - - [23/Feb/2020:01:13:51 +0800] "GET /index.html HTTP/1.0" 200 11
10.0.0.6 - - [23/Feb/2020:01:13:53 +0800] "GET /index.html HTTP/1.0" 200 11
10.0.0.6 - - [23/Feb/2020:01:13:55 +0800] "GET /index.html HTTP/1.0" 200 11
[root@web02 logs]#