文章目录
直接来吧展示!!!
根据上次做的透明代理为基础进行实验
博客地址点这里
添加两台WEB服务器
添加主页
[root@web01 ~]# cd /var/www/html/
[root@web01 html]# ls
[root@web01 html]# echo "<h1>This is web01</h1>" > index.html
[root@web01 html]# systemctl stop firewalld
[root@web01 html]# systemctl start httpd
squid设置
[root@localhost squid-reports]# vim /etc/squid.conf
http_port 192.168.10.10:80 accel vhost vport
# Squid normally listens to port 3128
http_port 192.168.10.10:80 accel vhost vport
cache_peer 20.0.0.3 parent 80 0 no-query originserver round-robin max_conn=30 weight=1 name=web1
cache_peer 20.0.0.4 parent 80 0 no-query originserver round-robin max_conn=30 weight=1 name=web2
cache_peer_domain web1 web2 www.juejue.com
[root@localhost squid-reports]# systemctl stop httpd
[root@localhost squid-reports]# service squid reload
[root@localhost squid-reports]# service squid restart
正在关闭 squid...
正在启动 squid...
[root@localhost squid-reports]# netstat -ntap |grep 80
tcp 0 0 192.168.10.10:80 0.0.0.0:* LISTEN 118551/(squid-1)
[root@localhost ~]# systemctl stop firewalld
客户机 DNS解析设置
访问测试
轮询成功,一个服务器是设置了网页的,一个没有设置