FreeBSD(squid缓存服务器配置篇)(3)


看到这样的页面说明Squid服务器是正常的,之所以出现错误页面,那是因为我们那台提供web服务的虚拟机没有启动的原因。
正式启动可以使用:
# squid -D

OK,我们的Squid01的配置就到这里, 现在我们关闭虚拟机,然后拷贝一份squid01为squid02,用来配置另一台Squid服务器。

复制好squid02后,我们现在开始配置了, 应为squid01的大部分工作都已经做好了, 所以squid02的配置就比较方便了,只要是配置文件中IP地址和机器名的修改。
服务器网络配置
# ee /etc/rc.conf
ifconfig_lnc0="inet 192.168.10.31 netmask 255.255.255.0"
defaultrouter="192.168.10.10"          
hostname="squid02.rd.bj"

# ee /etc/hosts
192.168.10.31    squid02.rd.bj

# ee /usr/local/etc/squid/squid.conf
最后修改好的配置文件为:
http_port 192.168.10.31:3128 vhost vport defaultsite=www.rd.bj

cache_mem 64 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 20 MB
minimum_object_size 0 KB
maximum_object_size_in_memory 5 MB
ipcache_size 1024
ipcache_low 90
ipcache_high 95
fqdncache_size 1024

#acl all src 0.0.0.0/0.0.0.0
acl gsrc src 192.168.10.20 192.168.10.30 192.168.10.31 192.168.10.40
http_access allow gsrc

acl Manager proto cache_object
acl Localhost src 127.0.0.1
http_access allow Manager Localhost

acl Safe_ports port 3128 80 3130 3131
http_access deny !Safe_ports
http_access allow all

visible_hostname squid01.rd.bj
cache_mgr admin@rd.bj
cache_effective_user squid                          
cache_effective_group squid                         
tcp_recv_bufsize 65536 bytes                        
cache_peer 192.168.10.30 sibling 3128 3130          
cache_peer_access 192.168.10.30 allow all           
cache_peer 192.168.10.40 parent 80 0 no-query originserver no-digest
access_log /usr/local/squid/logs/access.log
cache_dir diskd /usr/local/squid/cache 256 16 256 Q1=60 Q2=50
error_directory /usr/local/etc/squid/errors/Simplify_Chinese
icp_port 3131
htcp_port 0
icp_query_timeout 2000
icp_access allow all
digest_generation on
log_icp_queries on
icp_hit_stale on

保存退出后,按照squid01的测试方法,对squid02进行测试,如果结果和squid01一样,那我们的squid缓存服务器也就暂告一段落了。

最后,关于Squid,给大家推荐一本好书《Squid中文权威指南》下载见  虽然讲的是squid2.5版本的,但是有很好的指导意义,我相信大多数人都已经看过了,在此推荐是对作者辛勤劳动的无比崇敬。好,我们即将要踏上proxy服务器之旅。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wywdwg.html