Centos 7.4 Squid服务

159 阅读1分钟

yum install -y squid*

Vim /etc/squid/squid.conf   (配置文件)

http_access allow all     允许所有可以访问

http_port 192.168.1.254:8080  改端口

cache_dir ufs /var/spool/squid 10240 16 256       缓存目录

dns_nameservers  加上IPDNS服务器

cache_mem 512 MB         高速缓存

cache_log /var/logsquid/access.log 缓存日志

cache_access_log /var/log/squid/access.log 缓存访问日志

cache_store_log 网页缓存日志

cache_effective_user 设置squid的拥有者

cache_effect_group 设置squid所属组

visible_hostname 192.168.65.10 设置squid可见主机名

cache_mgr root@local.com 设置管理员E-mail地址

redirect_children 重定向器池进程数

squid -z   重新清理缓存

service squid restart

普通代理服务

Centos1

在Centos1上安装httpd

Mkdir /www

Echo ‘1111111’>/www/index.html

Vim /etc/httpd/conf/httpd.conf

添加

Service httpd restart

Centos2

添加一张网卡 此时ifconfig 会看到新的一张网卡名称eno33554984

Cd /etc/sysconfig/network-scripts/

Cp ifcfg-eno16777736 ifcfg-eno33554984

修改两行,添加三行

service network restart

Yum install –y squid*

Vim /etc/squid/squid.conf

Squid –z

Service squid restart

Windows客户端

修改IP 关闭防火墙

反向代理服务

Centos1

在Centos1上安装httpd

Mkdir /www1

Echo ‘22222222’>/www1/index.html

Vim /etc/httpd/conf/httpd.conf

添加

Service httpd restart

Centos2

添加一张网卡 此时ifconfig 会看到新的一张网卡名称eno33554984

Cd /etc/sysconfig/network-scripts/

Cp ifcfg-eno16777736 ifcfg-eno33554984

修改两行,添加三行

Service network restart

vim /etc/squid/squid.conf

添加这两个命令

squid –z

service squid restart

Windows客户端

修改IP 关闭防火墙

这里添加代理IP为第二台第二张网卡的IP

测试结果