修改ip地址 vi /etc/sysconfig/network-scripts/ifcfg-ens33
调度机CentOS修改为192.168.67.129
修改 vi /usr/local/nginx/conf/nginx.conf
upstream www.bbs.com{
server 172.20.10.13:80 weight=1; //weight代表权重,权重越高被分配到的几率越大
server 172.20.10.14:80 weight=1;
}
upstream www.html.com{
server 172.20.10.16:80 weight=1; //匹配静态服务器
}
server
{
listen 80 default_server;
#listen [::]:80 default_server ipv6only=on;
server_name _;
location /{
proxy_pass http://www.bbs.com;
}
location /Uploads{
proxy_pass http://www.html.com; //以Uploads开头的路径分配到静态服务器中
}
location /index{
proxy_pass http://www.html.com; //以index开头的路径分配到静态服务器中
}
access_log /home/wwwlogs/access.log;
}
重新载入nginx的配置文件/usr/local/nginx/sbin/nginx -s reload
任意服务器修改ip vi /etc/sysconfig/network-scripts/ifcfg-ens33
重启网络生效service network restart
web1 ip: 192.168.67.131
web2 ip: 192.168.67.132
访问调度机
http://192.168.67.129/
即可 访问到131和132