实现反向代理最基本的两处选项,修改squid.conf
1.在squid.conf中的http_port配置住行添加vhost选项,以支持虚拟主机映射

#vi  /etc/squid/squid.conf
http_port  squid服务器IP vhost
2.指定web服务器主机位置
使用cache_peer配置指定web服务器主机位置,格式如下
cache_peer  web服务器IP 服务器类型 http端口 icp端口 【可选项】
服务器类型一般使用parent(父服务器)icp端口用户连接相邻ICP缓存服

务器(通常为另外一台squid主机),如果没有使用0; 可选项提供缓存

时的一些附件参数,如originserver表示该服务器作为提供web服务的原始

主机,weight=n指定服务器的优先权重,n为整数,数值越大优先级越高

,默认为1. ;max-conn=n 指定反向代理主机到该web服务器的最大连接

数。
cache_peer 192.168.2.11 parent 80 0 originserver weight=5 max-conn=10
cache_peer 192.168.1.21 parent 80 0 originserver