CentOS 安装Squid代理

环境:

华为云服务器一台:123.60.53.69,放行3128端口

Windows 11 电脑:动态IP

需求:

客户端电脑通过华为云服务器实现代理上网

一、服务器设置

1、安装

复制代码
yum install squid httpd-tools -y

2、创建用户,生成密码文件

bash 复制代码
htpasswd -cd /etc/squid/passwd tom.ma

# 创建密码
New password: 
Re-type new password: 
Adding password for user tom.ma

3、检查是否存在验验文件

bash 复制代码
rpm -ql squid | grep ncsa_auth

# 输出
/usr/lib64/squid/basic_ncsa_auth
/usr/share/man/man8/basic_ncsa_auth.8.gz

4、编辑配置文件

bash 复制代码
vim /etc/squid/squid.conf


# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost

#########新增的内容#########

# 使用帐号密码认证方式使用代理
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd
# 定义用户的登录时显示的内容
auth_param basic realm This is a Squid Proxy Server
# 定义授权组
acl authenticated proxy_auth REQUIRED
# 允许授权组
http_access allow authenticated

# And finally deny all other access to this proxy
http_access deny all

5、启动

复制代码
systemctl start squid

二、客户端设置

1、windows11 设置代理

2、我们用Edge浏览器上网,此时我们输入账密验证

3、登录成功后,我们正确能打开网站

4、我们查看我们电脑的IP

相关推荐
渣渣灰95879 小时前
解决VMware上终端窗口太小问题
运维·服务器·经验分享
Tim风声(网络工程师)9 小时前
QoS (服务质量)和TE(流量工程)的区别
运维·网络
OpsEye9 小时前
企业监控避坑:别再把工具当体系!
运维·运维开发
活蹦乱跳酸菜鱼10 小时前
linux ATF BL2执行过程
linux
线束线缆组件品替网10 小时前
Amphenol ICC RJE1Y33610162401解析:工业网络线束为何越来越重要?
运维·服务器·网络·数码相机·智能路由器·电脑·智能音箱
NOCSAH11 小时前
统好AI:采购发票与付款管理的自动化协同实践
运维·人工智能·自动化·统好ai
淡淡烟雨淡淡愁11 小时前
安装libreoffice
linux
蜀道山老天师11 小时前
云原生监控入门:监控基础概念 + SLI/SLO/SLA 详解 + Prometheus 从零安装配置
linux·运维·云原生·prometheus
AIDF202611 小时前
linux 服务器网络问题排查
linux·服务器·网络
fred_kang11 小时前
Windows 下 Nginx 启动报错 10013 / OpenEvent 完整排查指南
运维·windows·nginx