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
相关推荐
码农胖虎-java4 分钟前
技术深析:Delayed ACK与Nagle算法的“相爱相杀”
运维·服务器·网络
漂视数字孪生世界6 分钟前
项目案例|某水轮机数字孪生平台
运维·信息可视化·自动化·数字孪生·三维可视化
北京迅为24 分钟前
【北京迅为】iTOP-4412精英版使用手册-第七十八章 Qt界面切换
linux·人工智能·嵌入式·4412
幺零九零零1 小时前
Docker底层- 命令详解
运维·docker·容器
Tipriest_1 小时前
linux中的文本分接流tee命令介绍
linux·服务器·数据库
爱喝水的鱼丶1 小时前
SAP-ABAP:在SAP世界里与特殊字符“斗智斗勇”:一份来自实战的避坑指南
运维·服务器·数据库·学习·sap·abap·特殊字符
阿拉伯柠檬1 小时前
MySQL内置函数
linux·数据库·mysql·面试
磊 子1 小时前
第四章:网络层
运维·服务器·网络·计算机网络·运输层
Xの哲學1 小时前
Linux CFS 调度器深度解析
linux·服务器·算法·架构·边缘计算
大聪明-PLUS1 小时前
关于 systemd 和桌面应用程序自动启动
linux·嵌入式·arm·smarc