| 如SHARERA.COM的情况,是一个多域名的CMS系统。这种情况下SQUID可以做如下配置,满足
这种CACHE的需求--当然现在没有这么做:测试的拓扑图如下:
|--------server_1(主频道如www.mosns.com)
|
CLIENT-BROWSER---------- >SQUID SERVER ----|
|
|-------server_2 (所有其他域名如haka.mosns.com)
这种情况下,server_1主要提供WWW.MOSNS.COM的频道下的页面的输出。server_2主要负责
其他所有域名下的页面的输出。
SQUID还支持负载均衡的方式(round-robin),这样也可以不用对域名进行指定。那么在这种
情况下,前台两台SQUID为主服务器互为热备,后台有几台WEB服务器生成页面,也是一个不错
的方案,对于中型网站来说。
cache_peer ip.of.server1 parent 80 0 no-query originserver round-robin
cache_peer ip.of.server2 parent 80 0 no-query originserver round-robin
以下为SQUID.CONF的配置
=========================================================
http_port 8815 accel defaultsite=www.mosns.com vhost
cache_peer 192.168.2.9 parent 8813 0 no-query originserver name=server_1
cache_peer_domain server_1 www.mosns.com bbs.mosns.com
cache_peer 192.168.2.6 parent 8813 0 no-query originserver name=server_2
cache_peer_domain server_2 .mosns.com
# OPTIONS WHICH AFFECT THE CACHE SIZE
# -----------------------------------------------------------------------------
cache_mem 16 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 4096 KB
minimum_object_size 0 KB
maximum_object_size_in_memory 80 KB
ipcache_size 1024
ipcache_low 90
ipcache_high 95
cache_replacement_policy lru
memory_replacement_policy lru
# LOGFILE PATHNAMES and CACHE DIRECTORIES
# -----------------------------------------------------------------------------
cache_dir ufs /tmp/squid/cache 4096 56 256
cache_log /tmp/squid/logs/cache.log
emulate_httpd_log on
cache_store_log /tmp/squid/logs/store.log
refresh_pattern . 0 20% 4320
quick_abort_min 0 KB
quick_abort_max 0 KB
# TIMEOUTS
# -----------------------------------------------------------------------------
forward_timeout 20 seconds
connect_timeout 15 seconds
read_timeout 3 minutes
request_timeout 1 minutes
persistent_request_timeout 15 seconds
client_lifetime 15 minutes
half_closed_clients off
shutdown_lifetime 5 seconds
# ADMINISTRATIVE PARAMETERS
# -----------------------------------------------------------------------------
cache_mgr haka@sharera.com
cache_effective_user squid
cache_effective_group squid
visible_hostname www.mosns.com
# OPTIONS FOR THE CACHE REGISTRATION SERVICE
# ----------------------------------------------------------------------------
# HTTPD-ACCELERATOR OPTIONS
# -----------------------------------------------------------------------------
# MISCELLANEOUS
logfile_rotate 0
tcp_recv_bufsize 65535 bytes
error_directory /usr/local/squid/share/errors/Simplify_Chinese
# DELAY POOL PARAMETERS (all require DELAY_POOLS compilation option)
# -----------------------------------------------------------------------------
client_persistent_connections off
server_persistent_connections on
vary_ignore_expire on
strip_query_terms on
# ACCESS CONTROLS
#---------------------------------------------------
acl OverConnLimit maxconn 20
http_access deny OverConnLimit
#acl AntiGoogle req_header User-Agent Googlespider
#http_access deny AntiGoogle
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl myip dst 192.168.2.0/24
acl mydomain dstdomain .mosns.com
acl purgehost src 192.168.2.0/24
acl purgemethod method PURGE
acl Safe_ports port 80 # http
acl Safe_ports port 8813 # http
acl Safe_ports port 8815 # http
acl CONNECT method CONNECT
#always_direct allow Srvdm
#never_direct allow !Srvdm
http_access allow manager localhost
http_access deny manager
http_access allow purgemethod purgehost
http_access deny !Safe_ports
http_access deny CONNECT all
http_access allow myip
http_access allow mydomain
http_access deny all
#http_reply_access allow all
#icp_access deny all
#icp_port 0
|