Squid
1.Squid正向代理
【真机】
[root@foundation66 ~]# yum install squid -y
[root@foundation66 ~]# systemctl start squid
[root@foundation66 ~]# vim /etc/squid/squid.conf
56 http_access deny all ------> http_access allow all
62 #cache_dir ufs /var/spool/squid 100 16 256 ------> cache_dir ufs /var/spool/squid 100 16 256
[root@foundation66 ~]# systemctl restart squid
【虚拟机】
浏览器 -> Edit -> Preferences -> Advanced -> Network -> Settings -> Manual proxy cOnfiguration -> HTTP Proxy 172.25.254.29 Port 3128 -> OK
2.Squid反向代理加速
1)单代理
【无apache虚拟机】
[root@localhost ~]# yum install squid -y
[root@localhost ~]# systemctl start squid
[root@localhost ~]# vim /etc/squid/squid.conf
56 http_access deny all ------> http_access allow all
59 http_port 3128 ------> http_port 80 vhost vport
60 【添加】cache_peer 172.25.254.129 parent 80 0 no-query
62 #cache_dir ufs /var/spool/squid 100 16 256 ------> cache_dir ufs /var/spool/squid 100 16 256
[root@localhost ~]# systemctl restart squid
浏览器访问 172.25.254.229
2)多代理
【轮叫】
[root@localhost ~]# vim /etc/squid/squid.conf
56 http_access deny all ------> http_access allow all
59 http_port 3128 ------> http_port 80 vhost vport
60 【添加】cache_peer 172.25.254.129 parent 80 0 no-query originserver name=route1 round-robin weight=3
61 【添加】cache_peer 172.25.254.66 parent 80 0 no-query originserver name=route2 round-robin weight=1
62 【添加】cache_peer_domain www.westos.com route1 route2
64 #cache_dir ufs /var/spool/squid 100 16 256 ------> cache_dir ufs /var/spool/squid 100 16 256
##no-query 不查询
##originserver当父级节点为route1时做加速
##round-robin检测轮叫次数(超过限制转向下一个代理)
##weight= 轮叫限制
[root@localhost ~]# systemctl restart squid
浏览器访问 172.25.254.229 刷新网页
刷新3次后