yum -y install openssl-devl net-snmp-utils
wget
tar xvjf squid-3.2.7.tar.gz
cd squid-3.2.7
./configure --prefix=/usr/local/squid --enable-gnuregex --enable-epoll --enable-ssl --enable-snmp --enable-storeio=ufs,aufs --enable-async-io=180 --enable-linux-netfilter --enable-follow-x-forwarded-for --enable-large-cache-files --with-maxfd=65535
make
make install
echo '1617661' > /proc/sys/fs/file-max
ulimit -n 65535
echo '1024 65535' > /proc/sys/net/ipv4/ip_local_port_range
groupadd -g 1001 squid
useradd -g 1001 -u 1001 -d /dev/null -s /sbin/nologin squid
chown -R squid.squid /usr/local/squid
###squid 3.2 反向代理
发现squid的自动摘除后端故障主机的时间要小于LVS
cat /usr/local/squid/etc/squid
cache_effective_user squid
cache_effective_group squid
visible_hostname squid.cctvcjw.com
cache_replacement_policy lru
cache_dir ufs /usr/local/squid/var/cache_dir 20000 16 256
cache_log /usr/local/squid/var/logs/cache.log
cache_access_log /usr/local/squid/var/logs/cache_access.log
cache_store_log /usr/local/squid/var/logs/cache_store.log
http_access allow localhost
acl mynetwork src 192.168.2.0/24
http_access allow all
http_port 80 accel vhost vport
cache_peer 192.168.188.230 parent 80 0 no-query originserver round-robin weight=1 max-conn=1024 name=webserver1
cache_peer 192.168.188.229 parent 80 0 no-query originserver round-robin weight=1 max-conn=1024 name=webserver2
cache_peer_domain webserver1
cache_peer_domain webserver2 bbs.manwrx.com
cache_peer_access webserver2 allow all
cache_peer_access webserver1 allow all
maximum_object_size 200 MB
cache_swap_low 85
cache_swap_high 90
/usr/local/squid/sbin/squid -k parse 检查语法
/usr/local/squid/sbin/squid -zX 生成cache
/usr/local/squid/sbin/squid 启动squid
阅读(2142) | 评论(0) | 转发(0) |