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
相关推荐
Byte不洛4 分钟前
基于 C++ 手写 HTTP 服务器:从请求解析到响应构建全流程解析
linux·网络·c++·计算机网络·http
小橙子学AI6 分钟前
OpenClaw 定时任务与提醒:打造你的 AI 自动化工作流
运维·人工智能·自动化
DA02218 分钟前
Linux设备树,DTS、DTB浅析
linux·c语言·linux驱动
ONE_SIX_MIX11 分钟前
debian13 无显示器的 服务器,开机不自动加载nvidia 驱动的,解决
运维·计算机外设
ZTLJQ12 分钟前
网络通信的基石:Python HTTP请求库完全解析
开发语言·python·http
虾..16 分钟前
Linux 五种IO模型
linux·服务器·数据库
一只积极向上的小咸鱼17 分钟前
docker exec 命令详解
运维·docker·容器
CDN36021 分钟前
中小团队安全方案:360CDN 高防服务器基础配置
运维·服务器·安全
llm大模型算法工程师weng25 分钟前
AI + Docker + K8s:云原生时代的运维提效实战
运维·人工智能·云原生
KillerNoBlood34 分钟前
OpenClaw笔记
linux·网络·笔记