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
相关推荐
公众号:fuwuqiBMC10 小时前
(转自“服务器BMC”)服务器BMC芯片——AST1840
运维·服务器·fpga开发
wechatbot88810 小时前
解决企业微信官方 API 短板:iPad 协议全功能对接方案
java·汇编·windows·http·微信·企业微信
tianyuanwo10 小时前
深入理解 Linux 启动救援模式与控制台选择:从 x86 的 tty0 到 ARM 的 ttyS0
linux·grub·救援系统
爱网络爱Linux10 小时前
RHCSA+RHCE 10.0全新升级!红帽Ansible自动化运维
运维·自动化·ansible·rhce认证·rhel1o·linux10·rhce10
瞬间&永恒~10 小时前
【MySQL】练习5-1:配置慢查询日志
linux·运维·云原生
A153625510 小时前
五金批发电商业财一体化 ERP 推荐:打通订单、库存、财务对账
大数据·运维·人工智能·零售
Dxy123931021610 小时前
Python 实现POST上行压缩上传可用HTTP库汇总
开发语言·python·http
邪修king11 小时前
Re:Linux系统篇(四):权限Chapter--用户身份、权限位与目录权限三大核心问题
linux·运维·服务器
砍材农夫11 小时前
运维|devops|jenkins构建分支选择及执行日志展示
运维·jenkins·devops
午安~婉11 小时前
git中http与ssh连接
git·http·ssh