Squid


1.Squid正向代理

 

【真机】

[[email protected] ~]# yum install squid -y

Linux学习笔记 --Squid


[[email protected] ~]# systemctl start squid

 

[[email protected] ~]# vim /etc/squid/squid.conf

 56 http_access deny all ------> http_access allow all

Linux学习笔记 --Squid

 62 #cache_dir ufs /var/spool/squid 100 16 256 ------> cache_dir ufs /var/spool/squid 100 16 256

 Linux学习笔记 --Squid

[[email protected] ~]# systemctl restart squid

 

【虚拟机】

 

浏览器 -> Edit -> Preferences -> Advanced -> Network -> Settings -> Manual proxy cOnfiguration -> HTTP Proxy 172.25.254.29 Port 3128 -> OK

 Linux学习笔记 --Squid


2.Squid反向代理加速

 

1)单代理

 

【无apache虚拟机】

 

[[email protected] ~]# yum install squid -y

Linux学习笔记 --Squid


[[email protected] ~]# systemctl start squid

 

[[email protected] ~]# 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

Linux学习笔记 --Squid

 62 #cache_dir ufs /var/spool/squid 100 16 256 ------> cache_dir ufs /var/spool/squid 100 16 256

 Linux学习笔记 --Squid


[[email protected] ~]# systemctl restart squid

 

浏览器访问 172.25.254.229

 Linux学习笔记 --Squid


2)多代理

 

【轮叫】

 

[[email protected] ~]# 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

Linux学习笔记 --Squid

 64 #cache_dir ufs /var/spool/squid 100 16 256 ------> cache_dir ufs /var/spool/squid 100 16 256

 Linux学习笔记 --Squid


##no-query 不查询  

##originserver当父级节点为route1时做加速

##round-robin检测轮叫次数(超过限制转向下一个代理)

##weight= 轮叫限制

 

[[email protected] ~]# systemctl restart squid

 

浏览器访问 172.25.254.229 刷新网页

Linux学习笔记 --Squid

刷新3次后

Linux学习笔记 --Squid

相关文章: