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

相关推荐
JZC_xiaozhong2 小时前
数据不互通、审批慢?企业多系统智能协同与流程自动化解决方案
运维·自动化·流程管理·流程自动化·数据集成与应用集成·流程监控·流程可视化设计
爱学习的小囧2 小时前
ESXi 8.0 原生支持 NVMe 固态硬盘吗?VMD 配置详解教程
linux·运维·服务器·esxi·esxi8.0
坚持就完事了3 小时前
Linux中的变量
linux·运维·服务器
hERS EOUS3 小时前
nginx 代理 redis
运维·redis·nginx
handler013 小时前
从源码到二进制:深度拆解 Linux 下 C 程序的编译与链接全流程
linux·c语言·开发语言·c++·笔记·学习
Cat_Rocky3 小时前
利用Packet Tracer网络实验
linux·运维·服务器
嵌入式×边缘AI:打怪升级日志3 小时前
Linux 驱动实战:SR501 人体红外传感器驱动开发与调试全记录
linux·运维·驱动开发
正点原子3 小时前
【正点原子Linux连载】第三章 U-Boot使用 摘自【正点原子】ATK-DLRK3568嵌入式Linux驱动开发指南
linux·运维·驱动开发
Qbw20044 小时前
【Linux】进程地址空间
linux·c++
忍冬行者4 小时前
MongoDB 三节点副本集离线部署运维手册
运维·数据库·mongodb