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

相关推荐
cui__OaO3 分钟前
Linux驱动--驱动编译
linux·运维·服务器
SunnyRivers26 分钟前
深入理解Linux后台命令
linux·后台运行·重定向·nohub
刘叨叨趣味运维29 分钟前
快速掌握Linux启动过程:像看接力赛一样简单
linux
Q168496451539 分钟前
红帽Linux-进程、ssh、网络、软件包、文件系统
linux·运维·网络
ℳ₯㎕ddzོꦿ࿐1 小时前
Docker 环境下 Paperless-ngx 中文增强版部署实战
运维·docker·容器
wdfk_prog1 小时前
[Linux]学习笔记系列 -- [drivers][base]cpu
linux·笔记·学习
zhaoyun9271 小时前
ubuntu linux 安装net8 net9 net 10方法
linux·ubuntu
大母猴啃编程1 小时前
线程同步与互斥
linux
zwtahql2 小时前
ubuntu远程ssh连接
linux·ubuntu·ssh
南烟斋..2 小时前
嵌入式系统(51单片机)核心外设详解:UART通信与DS18B20温度采集
linux·运维·网络