Ubuntu squid

本文详细介绍了Squid代理服务器的配置文件squid.conf中的关键设置项,包括访问控制列表(ACL)的定义及如何通过这些列表来管理网络流量。针对内部网络的不同需求,设置了多个ACL来控制HTTP访问策略。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

/etc/squid/squid.conf的相关设置:
acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
#
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
#acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
#acl localnet src 172.16.8.0/24 # RFC1918 possible internal network
acl localnet src 192.168.236.0/24 # RFC1918 possible internal network
#
acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT

acl wktime1 time MTWHF 08:30-12:00
acl wktime2 time MTWHF 13:00-17:30
acl blacklist_regex url_regex "/etc/squid/blacklist_regex"
acl restlist_regex url_regex "/etc/squid/restlist_regex"

#http_access deny blacklist
http_access deny blacklist_regex
http_access deny wktime1 restlist_regex
http_access deny wktime2 restlist_regex

然后设置blacklist_regex
/etc/squid/blacklist_regex
gateway.dll
meebo
mail
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值