安装squid
1、官方网站为 http://www.squid-cache.org/,使用yum安装:
[root@VM-12-13-centos ~]# yum install -y squid
Installed:
squid-7:4.15-1.module_el8.5.0+860+303ccf92.x86_64
[root@VM-12-13-centos ~]# squid -v
Squid Cache: Version 4.15
配置文件路径:
vi /etc/squid/squid.conf
根据以下内容做修改
# Only allow cachemgr access from localhost
http_access allow localhost manager
# http_access deny manager
# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
# http_access deny to_localhost
#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost
# And finally deny all other access to this proxy
# http_access deny all
# Squid normally listens to port 3128
http_access allow all #放在http_access deny all 之前,允许任意客户机使用代理服务,控制规则自上而下匹配
http_access deny all
http_port 3128 #用来指定代理服务监听的地址和端口(默认的端口号为3128)
2、启动squid并设置开机启动
[root@VM-12-13-centos ~]# systemctl enable squid
Created symlink /etc/systemd/system/multi-user.target.wants/squid.service → /usr/lib/systemd/system/squid.service
[root@VM-12-13-centos ~]# systemctl start squid
[root@VM-12-13-centos ~]# systemctl status squid
● squid.service - Squid caching proxy
Loaded: loaded (/usr/lib/systemd/system/squid.service; disabled; vendor preset: disabled)
Active: active (running)
客户端应用使用代理
1、向日葵设置代理测试使用