|
acl all src 0.0.0.0/0.0.0.0
acl allow_ip src 192.168.2.1/255.255.255.0
acl manager proto cache_object
acl localhost src 192.168.2.32/255.255.255.255
acl SSL_ports port 443 563
acl Safe_ports port 80 21 443 563 70 210 1025-65535
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 localhost
http_access allow allow_ip
cache_effective_user squid
cache_effective_group squid
下面两个选项是用来定义squid加速模式的。用virtual来指定为虚拟主机模式。80端口为要加速的请求端口。采用这种模式时,Squid就取消了缓存及ICP功能,假如需要这些功能,必须设置httpd_accel_with_proxy选项。
httpd_accel_host virtual
httpd_accel_port 80
上一页 [1] [2] [3] [4] [5] 下一页
下面两个选项在透明代理模式下是必须设置成on的。在该模式下,Squid既是web请求的加速器,又是缓存代理服务器。
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
设置透明代理时,必须打开包转发功能,还要结合ipchains:
echo 1 > /proc/sys/net/ipv4/ip_forward
/sbin/ipchains -A input -j ACCEPT -i lo
/sbin/ipchains -A forward -s 192.168.2.1/24 -d 0/0 -j MASQ
2.用户认证设置
默认时,Squid本身不带任何认证程序,但是可以通过外部认证程序来实现用户认证。一般有以下的认证程序:LDAP认证、SMB认证、基于mysql的认证、基于sock5的密码认证和基于Radius的认证。下面介绍常用的ncsa实现的认证,ncsa是Squid源代码包自带的认证程序之一,实现步骤如下:
* 进入/usr/local/squid/auth_modules/NCSA目录,执行:
make
make install
* 编译成功后,会生成ncsa_auth的可执行文件,拷贝生成的可执行文件到/usr/bin目录下。
* 修改squid.conf文件的相关选项。
上一页 [1] [2] [3] [4] [5] 下一页
|