Squid安装与设置
[*]
安装Squid Squid in Windows
http://www.acmeconsulting.it/pagine/opensource/squid/SquidNT.htm
a) 下载最新的Squid
b) 解压缩到c:\Squid,也可以解压缩到别的盘,需要更多的配置,不能使用Squid.conf的默认参数
Squid in Ubuntu
源里有,使用新得利安装
[*]
设置Squid Windows: c:\squid\etc\squid.conf,保留squid.conf.default作为备份
Ubuntu: /etc/squid/squid.conf
[*]设置 visible_hostname <your_machine_name or other>
[*]可以修改http_port ,默认 3128
[*]
设置自己的Access List acl friends src <my friends ip list> # 定义friends ip 列表
http_access allow friends # 允许friends 使用代理,应该写在 deny all 之前
[*]
设置parent代理 cache_peer <proxy_ip> <type:parent|sibling> <http_port> <icp_port> <options:参见官网>
ex: cache_peer 1.1.1.1 parent 3128 0 no-query
定义 always_direct,直接访问,不使用parent代理
ex: acl edu_resources dstdomain .edu.cn # 定义教育网资源
always_direct allow edu_resources # 直接访问,不使用parent代理
定义 never_direct ,始终使用 parent 代理
ex: never_direct allow !edu_resources # 始终使用 parent 代理
[*]
允许代理p2p 默认情况下squid不允许使用p2p,查看 access.log,发现squid阻止了所有非443端口的CONNECT,打开所有端口的CONNECT就可以使用p2p软件了
ex: #注释掉 http_access deny CONNECT !SSL_ports,我还添加了
http_access allow CONNECT Safe_ports,不过觉得意义不大
[*]
启动Squid windows:
进入 c:\squid\sbin\目录:
c:\squid\sbin > squid.exe -i # 安装 squid 服务, squid.exe -r 可以卸载服务
c:\squid\sbin > squid.exe # 启动服务
ubuntu:
squid #启动服务
squid -k reconfigure #重启加载配置文件squid.conf
squid -k kill|shutdown # 停止 squid
[*]
关于 Ubuntu 的服务开机自动启动问题 不想系统启动的时候就开启squid,因为是在我的laptop上安装的squid
首先确认系统的默认runlevel-》 命令行: runlevel ,ubuntu 返回 N 2,说明默认的runlevel是2,进入目录
/ect/rc2.d/,重命名 S30squid为 K30squid,不默认启动squid
redhat 的默认runlevel 是5
页:
[1]