squid
简介
squid是一个高性能的代理缓存服务器,支持FTP、gopher、HTTPS和HTTP协议,是一种用来缓冲Internet数据的软件
服务端
安装
yum install -y squid
修改配置文件
cat /etc/squid/squid.conf | egrep -v "^#|^$"
acl inside src 10.10.1.0/23
acl SSL_ports port 443
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 CONNECT method CONNECT
acl cachemanager src 10.10.0.11 127.0.0.1 #允许本机和10.1.0.11清理缓存
acl Purge method PURGE
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow inside
http_access deny manager
http_access allow cachemanager Purge
http_access deny Purge
http_access allow all
http_access deny all
reply_body_max_size 102400 MB
http_port 3128
cache_mem 256 MB
maximum_object_size 400 MB
logformat combined %>a %6tr [%tl] "%rm %ru HTTP/%rv" %>Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh/%<a %mt
access_log daemon:/var/log/squid/access.log combined
coredump_dir /var/spool/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
query_icmp on
启动
systemctl enable squid --now
查看端口
netstat -anpt | grep 3128
客户端
linux环境代理
编辑/etc/profile配置文件
在文件底加入如下内容
#http代理配置
export http_proxy=http://192.168.0.1:3128
export https_proxy=http://192.168.0.1:3128
source /etc/profile
win环境代理
控制面板 ------> Internet选项 -----> 连接 ------> 局域网设置 ------> 为LAN使用代理服务器(打钩)-------> 高级 ---> 填写地址
标签:squid,http,Safe,ports,access,acl,port
From: https://www.cnblogs.com/kkit/p/18347426