您的位置:首页 > 运维架构 > 反向代理

squid 编译参数

2009-08-16 11:42 169 查看
下载略

编译安装

# tar -xzf squid-2.6.STABLE13.tar.gz

# cd squid-2.6.STABLE13

# ./configure  --with-maxfd=204800 '--enable-async-io' '--with-pthreads' /
 '--enable-storeio=ufs,aufs,diskd,null' '--enable-linux-netfilter' '--enable-linux-proxy' '--enable-arp-acl' /
 '--enable-epoll' '--enable-removal-policies=lru,heap' '--enable-snmp' '--enable-delay-pools' /
 '--enable-htcp' '--enable-cache-digests' '--enable-underscores' '--enable-referer-log' /
 '--enable-useragent-log' '--enable-auth=basic,digest,ntlm' '--enable-carp' '--with-large-files' /
 '--with-aufs-threads=192'
# make

# make install-strip

 

 

redhat 启动脚本 /etc/init.d/squid

#! /bin/bash
#
# squid      Start/Stop the squid caching proxy.
#
# chkconfig: - 95 05
# description: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. /
#              It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. /
#              Squid has extensive access controls and makes a great server accelerator. It runs on Unix and Windows and /
#              is licensed under the GNU GPL.
# processname: squid
# Source function library.
. /etc/init.d/functions
# Source our configuration file for these variables.
RETVAL=0
# Set up some common variables before we launch into what might be
# considered boilerplate by now.
prog=squid
path=/usr/local/squid/sbin/squid
ulimit -u unlimited
ulimit -n 204800
start() {
echo -n $"Starting $prog: "
pid=`pidofproc $path`
if checkpid $pid 2>&1; then
failure $"prog startup"
echo
echo squid is aready running
return 1
fi

daemon $path
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
stop() {
maxwait=30
echo -n $"Stopping $prog: "
pid=`pidofproc $path`
if ! checkpid $pid 2>&1; then
failure $"prog startup"
echo
echo squid is not running
return 1
fi
for ((i=0;;i++));
do
if [ $i -eq "0" ] && checkpid $pid 2>&1; then
# "shutdown" is very slowly, so we use "interrup"
#$path -k shutdown
$path -k interrupt
usleep 100000
fi
if checkpid $pid 2>&1; then
echo  -n .
else
break
fi
if [ $i -ge "$maxwait" ] && checkpid $pid 2>&1; then
$path -k kill
usleep 100000
break
fi
sleep 1
done
checkpid $pid
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
[ $RETVAL -eq 0 ] && failure $"prog shutdown" || success $"prog shutdown"
echo
return $RETVAL
}
restart() {
stop
start
}
reload() {
echo -n $"Reloading $prog: "
$path -k reconfigure
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
success
else
failure
fi
echo
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
status)
status $path
;;
condrestart)
[ -f /var/lock/subsys/$prog ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
exit 1
esac
exit $?
 

修改配置文件 /usr/local/squid/etc/squid.conf
cache_dir /opt/cache/chace1 40000 32 256

建立cache_dir
mkdir /opt/cache/chace1
初始化cache_dir
/usr/local/squid/sbin/squid -z
启动squid
/etc/init.d/squid start
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息