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
相关推荐
万山y17 分钟前
WSL SSH 服务器一站式配置教程
运维·服务器·ssh
半梦半醒*17 分钟前
Prometheus监控物理服务器
linux·运维·服务器·centos·prometheus
mzhan01720 分钟前
Linux: network: 拔插网线 interface down/up测试的痛点
linux·服务器·测试·破坏性测试
恒创科技HK20 分钟前
高防服务器分为哪几种?香港高防服务器有什么特点?
运维·服务器·安全
黑马金牌编程22 分钟前
如何判断一台服务器是否负载过高?
linux·运维·性能调优·性能分析·故障排查
WnHj22 分钟前
DORIS 服务器宕机重启后出现的问题
运维·服务器
小锋学长生活大爆炸22 分钟前
【知识】Linux将多条指令合并为一条执行
linux·运维·ubuntu
心灵宝贝3 小时前
CentOS 7 安装 bzip2-libs-1.0.6-13.el7.x86_64.rpm 的详细步骤
linux·运维·centos
mjx65304 小时前
windows查看端口使用情况,以及结束任务释放端口
linux
九皇叔叔5 小时前
Linux Shell 函数:从定义到实战,让脚本更高效
linux·运维·chrome·shell