6.4. 在 Squid 中配置域拒绝列表
要阻止对特定域的访问,请在 Squid 中配置域拒绝列表。阻止恶意或垃圾邮件的域会很有用。
先决条件
- 您已将 Squid 配置为缓存代理,用户可以使用代理。
流程
编辑
/etc/squid/squid.conf文件中的以下设置:acl domain_deny_list dstdomain "/etc/squid/domain_deny_list.txt" http_access deny all domain_deny_list重要在允许访问用户或客户端的第一个
http_access allow语句前添加这些条目。创建
/etc/squid/domain_deny_list.txt文件,并添加您要阻止的域。例如,要阻止对包括子域的example.com的访问,并只阻止example.net的访问,请添加:.example.com example.net重要如果您引用了 squid 配置中的
/etc/squid/domain_deny_list.txt文件,则该文件不能为空。如果文件为空,Squid 无法启动。重启
squid服务:# systemctl restart squid