GimmeS 2012-12-06
1.安装squid
shell~$ sudo apt-get install squid #很快就会装上并且还自动启动了.
Shell~$ whereis squid #可以查看squid主要文件装到什么地方去了.
2.修改配置
squid默认配制是不让任何用记使用它的,你需要做相应的修改.
shell~$ sudo gedit /etc/squid/squid.conf
1) 定位到
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
# Example rule allowing access from your local networks. Adapt
# to list your (internal) IP networks from where browsing should
# be allowed
#acl our_networks src 192.168.1.0/24 192.168.2.0/24
#http_access allow our_networks
http_access allow localhost
########add by LfT
acl my_network src 192.168.0.133 192.168.0.122 #设置你允许访问的(客户机)ip
http_access allow my_network
#########end add
# And finally deny all other access to this proxy
http_access deny all
2)再定位到
# Squid normally listens to port 3128
########change by LfT
http_port 192.168.0.111:808 #你(服务端)的局域网IP及开放的端口;原来是:http_port 3128
#########change add
# TAG: https_port
# Note: This option is only available if Squid is rebuilt with the
# --enable-ssl option
这样当你启用squid后,这几个ip就可使用这个代理了.
3.初始设置
如果是首次运行squid,你需要首先执行:
$ sudo squid -z (作用我不好用中文解释,但相信你一定能理解这样做必要性)
$sudo /etc/init.d/squid reload (加载配置)
$sudo /etc/init.d/squid restart
$ sudo squid -k parse (检验:如果没有任何消息输出,恭喜,你可以使用squid了)
4.启动与关闭
$ sudo squid (后台启动)
$ sudo squid -k shutdown (用这个命令关掉代理)