|
1 安装
yum install squid -y
2 Squid主要组成部分
服务名:squid 主程序:/usr/sbin/squid 配置目录:/etc/squid 主配置文件:/etc/squid/squid.conf 监听tcp端口号:3128 默认访问日志文件:/var/log/squid/access.log
3 配置内网访问外网特定域名
[root@localhost ~]# cat /etc/squid/squid.conf
acl localnet src 172.172.3.2 # RFC1918 possible internal network #定义ip或ip段 为localnet acl localnet src 172.18.240.99 # RFC1918 possible internal network #定义ip或ip段 为localnet acl SSL_ports port 443 acl Safe_ports port 80 # http 添加80端口到Safe_prots 以下同义 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 8686 # 美康端口 acl CONNECT method CONNECT
acl allowWeb dstdomain .dingtalk.com# 添加域名到 allowweb #acl allowweb dstdomain mirrors.aliyun.com acl allowweb dstdomain .baidu.com http_access deny !allowWeb # deny allowweb范围以外的域名
http_access deny !Safe_ports #deny safe_ports以外的端口
http_access deny CONNECT !SSL_ports #deny ssl_ports以外的端口 http_access allow localnet #允许localnet 网络内的ip http_access allow localhost
http_access deny all
# Squid normally listens to port 3128 http_port 33128 #端口
# Leave coredumps in the first cache dir coredump_dir /var/spool/squid
# # Add any of your own refresh_pattern entries above these. # refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 refresh_pattern . 0 20% 4320
来源:https://www.cnblogs.com/linuxbai/p/13026101.html |