[root@lb01 ~]# vim /etc/nginx/conf.d/test.com.conf
upstream web {
server 10.0.0.7:8000;
server 10.0.0.8:8000;
}
server {
listen 80;
server_name test.com;
location / {
proxy_pass http://web;
}
}
5、后端web配置 (所有的web都需要配置一致)
[root@web01 conf.d]# vim test.com.conf
server {
listen 8000;
server_name test.com;
root /web;
location / {
index index.html;
}
}
[root@web02 conf.d]# vim test.com.conf
server {
listen 8000;
server_name test.com;
root /web;
location / {
index index.html;
}
}