centos搭建 squid

1.安装

sudo yum install squid

2.备份

sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.bak

3.设置用户和组

sudo touch /etc/squid/passwords
sudo chown squid:squid /etc/squid/passwords
sudo chmod 400 /etc/squid/passwords

4.安装 htpasswd

sudo yum install httpd-tools

sudo htpasswd -c /etc/squid/passwords username #username 替换

输入密码 password

 

 5.编辑配置文件,增加内容 /etc/squid/squid.conf

# 开启基本身份验证

acl allowed_ip src 允许的ip

http_access allow allowed_ip


# auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwords # 是否是 64位

auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwords

auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours

# 设置访问控制规则,允许特定用户访问代理
acl authenticated_users proxy_auth REQUIRED
http_access allow authenticated_users

 6.重启代理

sudo systemctl restart squid

posted on   yaolunhui  阅读(12)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
历史上的今天:
2017-06-02 动态移动控件位置
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示