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
相关推荐
安卓开发者16 小时前
第14讲:HTTP网络请求 - Dio库的使用与封装
网络·网络协议·http
3DVisionary16 小时前
基于数字图像相关(DIC)技术的机械臂自动化焊接残余应力全场变形高精度测量
运维·自动化·数字图像相关·自动化焊接·焊接变形·全场测量·机械臂/机器人
无泊里16 小时前
linux:系统用户命令
linux·运维·服务器
scd020816 小时前
11.10dns作业
运维·服务器·网络
Fcy64816 小时前
Linux下的项目自动化构建-make\makefile详解
linux·运维·自动化·makefile·make
keep__go17 小时前
zookeeper单机版安装
大数据·运维·zookeeper
chde2Wang17 小时前
Linux中bash: ls: 未找到命令… 相似命令是: ‘lz‘
linux·运维·bug·bash
2501_9159184117 小时前
HTTP和HTTPS工作原理、安全漏洞及防护措施全面解析
android·http·ios·小程序·https·uni-app·iphone
楼田莉子17 小时前
Linux学习:进程的控制
linux·运维·服务器·c语言·后端·学习
JiMoKuangXiangQu18 小时前
Linux:文件 mmap 读写流程简析
linux·内存管理·file mmap