Squid做反向加速,配合DNS轮询实现简单负载均衡典型配置

类别:网站制作 点击:0 评论:0 推荐:

编译squid的时候最少要加上 --disable-internal-dns编译选项,否则将不能使用。

[root@it800 /]# more /usr/local/squid/etc/squid.conf
http_port  192.168.33.10:800
icp_port 0
hierarchy_stoplist cgi-bin ?

acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY

cache_mem 48 MB
cache_swap_low 90
cache_swap_high 95
cache_dir ufs /usr/local/squid/var/cache 100 16 256
emulate_httpd_log on
log_ip_on_direct on
hosts_file /etc/hosts

auth_param basic children 5
auth_param basic credentialsttl 2 hours
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern .               0       20%     4320

acl all src 0.0.0.0/0.0.0.0
#acl localhost src 127.0.0.1/255.255.255.255
#acl to_localhost dst 127.0.0.0/8
acl accPort     port 800
acl accProto    proto HTTP FTP
acl accHostA     dstdomain .dxjy.org
acl accHostB    dstdomain .it800.biz
#http_access allow localhost all to_localhost
#http_access allow myNet toMyNet

http_access allow accProto accPort accHost
http_access allow accProto accPort accHostB
#http_reply_access allow all
#http_access allow all
http_access deny all

cache_effective_user    squid
cache_effective_group   squid
#visible_hostname www.it800.biz
httpd_accel_host 127.0.0.1
#httpd_accel_host 192.168.33.12
#httpd_accel_host c.it800.biz
httpd_accel_port 800
httpd_accel_single_host on
httpd_accel_with_proxy off
httpd_accel_uses_host_header on

error_directory /usr/local/squid/share/errors/Simplify_Chinese
uri_whitespace strip

cache_access_log /usr/local/squid/var/logs/access.log

#支持mrtg流量统计
acl snmppublic snmp_community public
snmp_port 3401
snmp_access allow snmppublic all

本文地址:http://com.8s8s.com/it/it31411.htm