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
相关推荐
wdxylb40 分钟前
云原生俱乐部-shell知识点归纳(1)
linux·云原生
飞雪20072 小时前
Alibaba Cloud Linux 3 在 Apple M 芯片 Mac 的 VMware Fusion 上部署的完整密码重置教程(二)
linux·macos·阿里云·vmware·虚拟机·aliyun·alibaba cloud
路溪非溪2 小时前
关于Linux内核中头文件问题相关总结
linux
木易双人青2 小时前
01-Docker-简介、安装与使用
运维·docker·容器
专注API从业者3 小时前
Python + 淘宝 API 开发:自动化采集商品数据的完整流程
大数据·运维·前端·数据挖掘·自动化
Lovyk4 小时前
Linux 正则表达式
linux·运维
Fireworkitte5 小时前
Ubuntu、CentOS、AlmaLinux 9.5的 rc.local实现 开机启动
linux·ubuntu·centos
sword devil9006 小时前
ubuntu常见问题汇总
linux·ubuntu
ac.char6 小时前
在CentOS系统中查询已删除但仍占用磁盘空间的文件
linux·运维·centos
中科米堆7 小时前
中科米堆CASAIM自动化三维测量设备测量汽车壳体直径尺寸
运维·自动化·汽车·视觉检测