#!/bin/sh
SQUID_CNF=
/etc/squid/squid
.conf
CACHE_DIR=(
/data/cache1
/data/cache2
)
yum
install
-y squid
cat
>>$SQUID_CNF <<EOF
http_port 80 accel vhost vport
cache_peer 192.168.149.128 parent 80 0 originserver name=wugk1
cache_peer 192.168.149.129 parent 80 0 originserver name=wugk2
cache_peer_domain wugk1 www.wugk1.com
cache_peer_domain wugk2 www.wugk2.com
visible_hostname localhost
forwarded_for off
via off
cache_vary on
acl manager proto cache_object
acl localhost src 127.0.0.1
/32
acl to_localhost dst 127.0.0.0
/8
0.0.0.0
/32
acl localnet src 10.0.0.0
/8
acl localnet src 172.16.0.0
/12
acl localnet src 192.168.0.0
/16
acl SSL_ports port 443
acl Safe_ports port 80 8080
acl Safe_ports port 21
acl Safe_ports port 443
acl all src 0.0.0.0
/0
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access allow all
acl PURGE method PURGE
http_access allow PURGE localhost
http_access deny PURGE
cache_dir aufs
/data/cache1
10240 16 256
cache_dir aufs
/data/cache2
10240 16 256
cache_mem 4000 MB
maximum_object_size 8 MB
maximum_object_size_in_memory 256 KB
hierarchy_stoplist cgi-bin ?
coredump_dir
/var/spool/squid
refresh_pattern ^
ftp
: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (
/cgi-bin/
|\?) 0 0% 0
refresh_pattern \.(jpg|png|gif|mp3|xml|html|htm|css|js) 1440 50% 2880 ignore-reload
refresh_pattern . 0 20% 4320
EOF
mkdir
-p ${CACHE_DIR[@]} ;
chown
-R squid:squid ${CACHE_DIR[@]}
/etc/init
.d
/squid
restart
if
[
"$?"
==
"0"
];
then
echo
"The Squid Server Install Successfully !!"
else
echo
"The Squid Server Install Failed !!,Please Check Log......"
fi