squid代理配置
1. 概述
本篇记录如何使用squid做代理,修改默认端口,允许特定网段节点使用代理访问特定域名
2. 过程
2.1 生成账号密码文件
htpasswd -c /etc/squid/.squid_users liwl
输入密码:liwanliang
执行结束,会创建/etc/squid/.squid_users
#账号liwl,密码:liwanliang
修改权限:chown squid.squid /etc/squid/.squid_users
验证:/usr/lib64/squid/basic_ncsa_auth /etc/squid/.squid_users
2.2 编辑配置文件
dns_v4_first on
acl SSL_ports port 443
acl CONNECT method CONNECT
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/.squid_users
auth_param basic children 5
auth_param basic realm Proxy Authentication Required
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
acl auth_users proxy_auth REQUIRED
acl user_liwl proxy_auth liwl
acl allowDomain dstdomain .qyapi.weixin.qq.com
http_access allow allowDomain
http_access deny !allowDomain
http_access allow localnet user_liwl
http_access deny all
http_port xxxx
coredump_dir /var/spool/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
保存配置,重启服务:systemctl restart squid
2.3 测试
curl -x 172.19.1.2:xxxx -U liwl:liwanliang --proxy-basic -o liwl.AppImage https://get.wiz.cn/x/wiznote-desktop-0.1.103-linux-x86_64.AppImage
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!