官网:
安装
sudo apt install squid
配置,在 /etc/squid/squid.conf 中添加或修改:
# 设置匿名代理forwarded_for deletevia off# 修改监听端口http_port 3128# 禁止域名访问http_access deny denysite .qq.com .google.com# 禁止域名访问也可以配文件# http_access deny "/etc/squid/denysite.list"# 如果禁止无效,检查下面这句命令的位置http_access deny denysite# 允许本地网络访问acl localnet src 10.0.0.0/8 # RFC1918 possible internal networkacl localnet src 172.16.0.0/12 # RFC1918 possible internal networkacl localnet src 192.168.0.0/16 # RFC1918 possible internal networkacl localnet src fc00::/7 # RFC 4193 local private network rangeacl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machineshttp_access allow localnet # 去掉本地网络访问权限的注释# 自定义一个名为walker的控制组,并允许此控制组。acl walker src 99.0.0.0/8 # 99段的A类地址acl walker src 5.4.3.2/32 # 单个IP地址5.4.3.2http_access allow walker # 允许walker组# 修改或添加 dnsdns_nameservers 223.5.5.5 119.29.29.29 114.114.114.114
重启服务
sudo systemctl restart squid.service# orsudo systemctl restart squid
*** ***