squid的安装与使用

444 阅读1分钟

一、 系统环境

操作系统:CentOS 8.2 64bit

Squid Cache: Version 4.4 

Service Name: squid

二、安装squid服务

2.1 检查squid软件是否安装

# rpm -qa|grep squid

2.2 如果未安装,则使用yum 方式安装

# yum -y install squid

2.3 设置开机自启动

# chkconfig --level 35 squid on //在3、5级别上自动运行squid服务

三、squid服务器的配置文件说明

squid 的主配置文件是 /etc/squid/squid.conf,所有squid的设定都是在这个文件里配置。

允许所有IP连接

acl all src 0.0.0.0/0.0.0.0

允许全部连接

http_access deny all改  http_access allow all

检查防火墙3128端口是否开放

启动服务

service squid start

四、客户端设置

编辑 /etc/profile 文件,在末尾加入以下代码,把*.*.*.*替换成你代理服务器地址

export proxy="http://*.*.*.*:3128"
export http_proxy=$proxy
export https_proxy=$proxy
export ftp_proxy=$proxy
export no_proxy="localhost, 127.0.0.1, ::1"