SQUID

squid正向代理

1.让虚拟机可以上网

vim /etc/sysconfig/network-scripts/ifcfg-eth0
GATEWAY=172.25.254.250                             ###通过250的电脑让虚拟机上网
DNS1=114.114.114.114
systemctl restart network

测试

route -n                                      ###查看网关
ping www.qq.com

2.squid安装和配置更改172.25.254.117

yum install -y squid            ##安装正向代理
vim /etc/squid/squid.conf       ##修改配置文件
 55 # And finally deny all other access to this proxy
 56 http_access allow all       ##允许访问
 57 
 58 # Squid normally listens to port 3128
 59 http_port 3128
 60 
 61 # Uncomment and adjust the following to add a disk cache directory.
 62 cache_dir ufs /var/spool/squid 100 16 256   ##创建缓存地点 100M 16个目录 256个子级目录
systemctl start squid       ##开启服务
netstat -lntup|grep squid   ##查看端口
如果防火墙未关
firewall-cmd --permanent --add-port=3128/tcp        ##
firewall-cmd --reload                   ##

在真机中打开浏览器设置代理服务器的ip地址(172.25.254.117)
用真机打开一个网页就可以正常上网

squid反向代理

1.准备两台虚拟机ip地址分别为真机ip+100 真机ip+200
2.在172.25.254.217中:

yum install -y squid
vim /etc/squid/squid.conf
    55 # And finally deny all other access to this proxy
    56 http_access allow all        ##允许访问
    57 
    58 # Squid normally listens to port 3128
    59 http_port 80 vhost vport
    60 cache_peer 172.25.254.117 parent 80 0 no-query
    61 # Uncomment and adjust the following to add a disk cache directory.
    62 cache_dir ufs /var/spool/squid 100 16 256    ##创建缓存地点 
systemctl start squid
systemctl stop firewalld

测试:
打开游览器输入172.25.254.217这时会访问到117

轮询

需要至少两台已经配置好apache的虚拟机和一台代理缓存(217)

vim /etc/squid/squid.conf
    cache_peer 172.25.254.117 parent 80 0 no-query originserver round-robin name=webserver1
    cache_peer 172.25.254.125 parent 80 0 no-query originserver round-robin name=webserver2
    cache_peer_domain webserver1 webserver2 www.westos.com

    # Uncomment and adjust the following to add a disk cache directory.
    cache_dir ufs /var/spool/squid 100 16 256

    # Leave coredumps in the first cache dir
    coredump_dir /var/spool/squid

在浏览器所在的主机添加解析
    vim /etc/hosts
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
第1章 介绍 1.1 Web缓存 1.2 Squid的简明历史 1.3 硬件和操作系统要求 1.4 squid是开源的 1.5 Squid的Web主页 1.6 获取帮助 1.6.1 FAQ 1.6.2 邮件列表 1.6.3 职业支持 1.7 启动Squid 第2章 获取Squid 2.1 版本和发布 2.2 使用源代码 2.3 预编译的二进制文件 2.4 匿名CVS 2.5 devel.squid-cache.org 第3章 编译和安装 3.1 安装之前 3.2 解开源代码包 3.3 调整内核 3.3.1 文件描述符 3.3.2 Mbuf Clusters 3.3.3 临时端口范围 3.4 Configure脚本 3.4.1 configure选项 3.4.2 运行configure 3.5 编译 3.6 安装 3.7 打补丁 3.8 重运行configure 第4章 快速配置向导 4.1 squid.conf语法 4.2 User ID 4.3 端口号 4.4 日志文件路径 4.5 访问控制 4.6 可见主机名 4.7 管理联系信息 4.8 下一步 第5章 运行Squid 5.1 squid命令行选项 5.2 对配置文件查错 5.3 初始化cache目录 5.4 在终端窗口里测试squid 5.5 将squid作为服务进程运行 5.5.1 squid_start脚本 5.6 启动脚本 5.6.1 /etc/rc.local 5.6.2 init.d和rc.d 5.6.3 /etc/inittab 5.7 chroot环境 5.8 停止squid 5.9 重配置运行中的squid进程 5.10 滚动日志文件 第6章 访问控制 6.1 访问控制元素 6.1.1 一些基本的ACL类型 6.1.2 ACL类型 6.1.3 外部ACL 6.1.4 处理长ACL列表 6.1.5 Squid如何匹配访问控制元素 6.2 访问控制规则 6.2.1 访问规则语法 6.2.2 Squid如何匹配访问规则 6.2.3 访问列表风格 6.2.4 延时检查 6.2.5 减缓和加速规则检查 6.3 常见用法 6.3.1 仅仅允许本地客户 6.3.2 阻止恶意客户 6.3.3 内容过滤 6.3.4 在工作时间的受限使用 6.3.5 阻止squid与非HTTP服务器会话 6.3.6 授予某些用户特殊的访问 6.3.7 阻止邻近cache的滥用 6.3.8 使用IP地址拒绝请求 6.3.9 http_reply_access示例 6.3.10 阻止对本地站点的cache命中 6.4 测试访问控制 第7章 磁盘缓存基础 7.1 cache_dir指令 7.1.1 参数:Scheme 7.1.2 参数:Directory 7.1.3 参数:Size 7.1.4 参数:L1和L2 7.1.5 参数:Options 7.2 磁盘空间基准 7.3 对象大小限制 7.4 分配对象到缓存目录 7.5 置换策略 7.6 删除缓存对象 7.6.1 删除个别对象 7.6.2 删除一组对象 7.6.3 删除所有对象 7.7 refresh_pattern 第8章 高级磁盘缓存主题 8.1 是否存在磁盘I/O瓶颈? 8.2 文件系统调整选项 8.3 可选择的文件系统 8.4 aufs存储机制 8.4.1 aufs如何工作 8.4.2 aufs发行 8.4.3 监视aufs操作 8.5 diskd存储机制 8.5.1 diskd如何工作 8.5.2 编译和配置diskd 8.5.3 监视diskd 8.6 coss存储机制 8.6.1 coss如何工作 8.6.2 编译和配置coss 8.6.3 coss发行 8.7 null存储机制 8.8 哪种最适合我? 第9章 Cache拦截 9.1 它如何工作? 9.2 为何要(或不要)拦截? 9.3 网络设备 9.3.1 内置Squid 9.3.2 四层交换 9.3.3 Cisco策略路由 9.3.4 Web Cache Coordination协议 9.4 操作系统配置 9.4.1 Linux 9.4.2 FreeBSD 9.4.3 OpenBSD 9.4.4 在NetBSD和其他系统上的IPFilter 9.5 配置Squid 9.5.1 配置WCCPv1 9.6 调试

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值