apt-get install squid 

修改配置文件:

找到 http_access deny all 在之前加入

auth_param basic program /usr/lib/squid3/basic_ncsa_auth(此文件不同版本略有变化,请注意修改) /etc/squid3/squid.password
auth_param basic children 5
auth_param basic realm Linxi
auth_param basic credentialsttl 1 hours
auth_param basic casesensitive off
acl password proxy_auth REQUIRED
http_access allow password
http_access deny all

删除 http_access allow localhost

 

/etc/squid3/squid.password 生成方法:

初次生成 : htpasswd -c /etc/squid3/squid.password user

以后添加用户 : htpasswd /etc/squid3/squid.password user

文献 : http://www.netpc.com.cn/doc/squid/