Linux HTTP代理Squid 基本变更配置及目标白名单方式限制转发

1、文件管理转发白名单

sudo touch /etc/squid/whitelistip

sudo touch /etc/squid/whitelistdomain

复制代码
# 目的地ip地址
acl whitelistip dst "/etc/squid/whitelistip"
http_access allow whitelistip

# 目的地域名限制,可使用.xxx.com 放开整个子域名
acl whitelistdomain dstdomain "/etc/squid/whitelistdomain"
http_access allow whitelistdomain

2、限制来源ip

sudo touch /etc/squid/whitelistsrcip

复制代码
# 可以使用ip段如:12.12.12.1/24
acl whitelistsrcip src "/etc/squid/whitelistsrcip"
http_access allow whitelistsrcip

3、日志存储

复制代码
# 详细:https://wiki.squid-cache.org/SquidFaq/SquidLogs#accesslog
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh %{host}>h
# 日志路径
access_log /data/logs/squid/access.log combined

4、监听端口

复制代码
# 自己定
http_port 8999

5、端口白名单

默认配置放开了很多ip,可以根据情况只放开80,443等自己要用的,把其他的注释了

复制代码
acl SSL_ports port 443
acl Safe_ports port 443
acl Safe_ports port 80
相关推荐
专注VB编程开发20年18 分钟前
安卓APP与服务器通讯技术,文件传输和文字消息收发
运维·服务器
顺风尿一寸22 分钟前
深入Linux内核:mkdir系统调用的完整实现解析
linux
用户23678298016823 分钟前
Linux free 命令深度解析:从内存监控到 OOM 排查的完整指南
linux
Agent手记40 分钟前
电信运营商如何用AI实现携号转网自动处理?基于实在Agent的业务自动化落地与TARS大模型解析方案
运维·人工智能·ai·自动化
无足鸟ICT1 小时前
【RHCA+】boxes命令(艺术框)
linux
wanhengidc1 小时前
云手机搬砖 像僵尸开炮
运维·网络·智能手机·云计算
_Voosk1 小时前
FreeBSD 使用代理运行命令
linux·运维·freebsd
信息安全失业大专人员1 小时前
HTTP/HTTPS 协议精髓与 WAF(Web 应用防火墙)架构防线大底座
web安全·http·信息安全·https·企业信息安全
lihui_cbdd2 小时前
HPC 集群上 OpenMM GPU 多版本安装实战指南
运维·服务器·人工智能·计算化学
G_dou_2 小时前
Linux 搭建 Rust 开发环境:从 rustup 安装到 Cargo 镜像
linux·rust