Squid-搭建代理服务器

安装

yum -y install squid 安装
yum -y removed squid  卸载

配置

白名单验证:

# /etc/squid/squid.conf
acl client src xx.xx.xx.xx   #ip白名单
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 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7       # RFC 4193 local private network range
acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines

acl SSL_ports port 443
acl Safe_ports port 3128
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

http_access allow client
cache_access_log /var/log/squid/access.log #访问日志路径
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
#visible_hostname proxy.test.com #可见主机名
cache_dir ufs /var/spool/squid 100 16 256
#ufs:缓存数据的存储格式
#/var/spool/squid 缓存目录
#100: 缓存目录占磁盘空间大小(M)
#16:缓存空间一级子目录个数
#256:缓存空间二级子目录个数

启动

squid -z  --初始化缓存目录 
squid start  --启动
squid -k parse  --检查配置文件

参考1
squid中文
白名单,账号密码验证
账号密码验证

你可能感兴趣的:(爬虫实战)