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

相关推荐
爱学习的小囧44 分钟前
VMware ESXi 6.7U3v 新版特性、驱动集成教程和资源包、部署教程及高频问答详情
运维·服务器·虚拟化·esxi6.7·esxi蟹卡驱动
小疙瘩1 小时前
只是记录自己发布若依分离系统到linux过程中遇到的问题
linux·运维·服务器
dldw7771 小时前
IE无法正常登录windows2000server的FTP服务器
运维·服务器·网络
运维有小邓@2 小时前
什么是重放攻击?如何避免成为受害者?
运维·网络·安全
我是伪码农2 小时前
外卖餐具智能推荐
linux·服务器·前端
汤愈韬3 小时前
下一代防火墙通用原理
运维·服务器·网络·security
皮皮林5513 小时前
强烈建议大家使用 Linux 做开发?
linux
IMPYLH3 小时前
Linux 的 od 命令
linux·运维·服务器·bash
Kk.08024 小时前
Linux(十一)fork实例练习、文件操作示例及相关面试题目分享
linux·运维·算法
数据雕塑家5 小时前
Linux下大文件切割与合并实战:解决FAT32文件系统传输限制
linux·运维·服务器