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
相关推荐
切糕师学AI2 分钟前
DevOps是什么?
运维·devops
江畔何人初8 分钟前
理解容器挂载点
linux·运维·云原生
YMWM_18 分钟前
cursor连接Ubuntu远程
linux·运维·ubuntu
Python-AI Xenon28 分钟前
RHEL/CentOS 7.9环境中离线安装Telnet服务完整指南
linux·运维·telnet·rhel7.9
Trouvaille ~30 分钟前
【Linux】进程信号(三):信号捕捉与操作系统运行原理
linux·运维·服务器·c++·操作系统·信号·中断
欧洵.36 分钟前
HTTPS加密流程:从原理到关键要点拆解
网络协议·http·https
zl_dfq38 分钟前
Linux 之 【进程间通信】(消息队列与信号量、Systrm VIPC在内核中数据结构设计)
linux
信创天地41 分钟前
国产化数据库深度运维:性能调优与故障排查实战指南
运维·数据库·安全·elk·自动化·rabbitmq
木卫二号Coding1 小时前
Docker-构建自己的Web-Linux系统-镜像colinchang/ubuntu-desktop:22.04
linux·ubuntu·docker
维度攻城狮1 小时前
Ubuntu突然无法中文输入的问题解决办法
linux·运维·ubuntu