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

相关推荐
Fᴏʀ ʏ꯭ᴏ꯭ᴜ꯭.16 分钟前
Haproxy ACL实战:精准分流与访问控制
运维
Eiceblue20 分钟前
.NET框架下Windows、Linux、Mac环境C#打印PDF全指南
linux·windows·.net
RockHopper202524 分钟前
解读数字化生产运行系统的裁决机制
运维·系统架构·智能制造·isa-95·isa-88
试试勇气27 分钟前
Linux学习笔记(十三)--文件系统
linux·笔记·学习
guizhoumen36 分钟前
2026年建站系统推荐及选项指南
大数据·运维·人工智能
yingdonglan1 小时前
鸿蒙跨端Flutter学习——GridView高级功能
linux·运维·windows
wdfk_prog1 小时前
[Linux]学习笔记系列 -- [drivers][clk]clk
linux·笔记·学习
遇见火星1 小时前
在Linux中使用journalctl命令进行日志分析和管理详细教程
linux·运维·服务器·journalctl
xuefuhe1 小时前
RHEL9 yum install etcd Error: Unable to find a match: etcd
linux·运维·centos
我送炭你添花2 小时前
树莓派部署 GenieACS 作为终端TR-069 ACS(自动配置服务器)的详细规划方案
运维·服务器·网络协议