- 论坛徽章:
- 0
|
1,准备工作:
squid-2.6.STABLE13.tar.gz以及httpd-2.2.2.tar.gz和AS4;
配置好静态路由;
2,安装squid以及httpd
安装squid:
tar -zxvf squid-2.6.STABLE13.tar.gz
cd squid-2.6.STABLE13
./configure --prefix=/usr/local/squid
make all
make install
安装认证模块:
cd /home/zhq/helpers/squid-2.6.STABLE13/basic_auth/NCSA
make
make install
安装apache:
tar -zxvf httpd-2.2.2.tar.gz
cd httpd-2.2.2
./configure --prefix=/usr/local/apache
make
make install
3,配置squid.conf
http_port 8080 #此处为端口配置;
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
cache_dir ufs /home/squid/cache 1000 16 256
access_log /home/squid/logs/access.log squid
cache_log /home/squid/logs/cache.log
cache_store_log /home/squid/logs/store.log
auth_param basic program /usr/local/squid/libexec/ncsa_auth /usr/local/squid/etc/squidpasswd #此处为用ncsa_auth这种认证方式,在/etc/squid/squidpasswd里面读取认证信息;
auth_param basic children 5 #此处为说明有5个子进程;
auth_param basic realm proxy1.****.edu.cn #此处声明可以填写proxy2.****.edu.cn来取代IP,但不用在DNS里配置;
auth_param basic credentialsttl 2 hours #此处声明2小时后过期,要重新认证;
auth_param basic casesensitive off #此处声明取消大小写;
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 auth_user proxy_auth REQUIRED
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 563
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 563 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow auth_user
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
http_reply_access allow all
icp_access allow all
cache_effective_user squid
visible_hostname proxy1.****.edu.cn
4,说明:
squid启动:/usr/loca/squid/sbin/squid
若要自启动,加入:/etc/rc.local
加认证用户:/usr/local/apache/bin/htpasswd /usr/local/squid/etc/sqidpasswd zhq |
|