Squid代理服务器——传统代理,透明代理
缓存代理概述
web代理的工作机制:
缓存网页对象,减少重复请求
代理的基本类型
- 传统代理:适用于Internet,需明确指定服务端
- 透明代理:客户机不需要指定代理服务器的地址和端口,是通过默认路由,防火墙将web重定向给代理
使用代理的好处
- 提高web访问速度
- 隐藏客户机的真实IP地址
一、传统代理
实验环境
squid服务器 192.168.13.179
web服务器 192.168.13.151
client测试机192.168.13.135
1、在squid服务器上安装squid代理服务器
[root@squid ~]# mkdir /abc
[root@squid ~]# mount.cifs //192.168.100.3/LNMP-C7 /abc/ ##挂载
[root@squid ~]# cd /abc/
[root@squid abc]# tar zxvf squid-3.4.6.tar.gz -C /opt ##解压
[root@squid abc]# yum install gcc gcc-c++ make -y ##安装环境组件
[root@squid abc]# cd /opt/squid-3.4.6
[root@squid squid-3.4.6]# ./configure \
--prefix=/usr/local/squid \ ##安装路径
--sysconfdir=/etc \ ##配置文件目录
--enable-arp-acl \ ##支持acl访问控制列表
--enable-linux-netfilter \ ##支持网络筛选
--enable-linux-tproxy \ ##支持透明
--enable-async-io=100 \ ##io优化
--enable-err-language="Simplify_Chinese" \ ##报错显示简体中文
--enable-underscore \
--enable-poll \
--enable-gnuregex ##支持正则表达
[root@squid squid-3.4.6]# make && make install ##编译安装
[root@squid squid-3.4.6]# ln -s /usr/local/squid/sbin/* /usr/local/sbin/ ##便于系统识别
[root@squid squid-3.4.6]# useradd -M -s /sbin/nologin squid ##创建系统用户
[root@squid squid-3.4.6]# chown -R squid.squid /usr/local/squid/var/ ##给目录所有文件属主属组权限
2、修改squid配置文件,并优化启动项
[root@squid squid-