CentOS 7 搭建 TinyProxy 代理

TinyProxy 和 Squid 都是比较优秀的代理软件

TinyProxy比较小众,虽然没有Squid的功能丰富,但是小巧简单,也能满足普通用户的需求。

Squid 是一款优秀的代理软件,有很丰富的ACL管理功能,虽然squid很强大,但配置比较繁琐。

 

1. 安装 TinyProxy

yum -y install tinyproxy

 

2. 配置 TinyProxy

vim /etc/tinyproxy/tinyproxy.conf

修改 Port 端口,默认为 8888

Port 8888

注释掉 Allow,表示允许所有人访问代理

#Allow 127.0.0.1

隐藏掉Via请求头部,去掉下面的注释

DisableViaHeader Yes

更多配置项,下面是列举一些配置文件默认的,不需要配置:

PidFile “/var/run/tinyproxy/tinyproxy.pid”
LogFile “/var/log/tinyproxy/tinyproxy.log”
LogLevel Info
MaxClients 100
MinSpareServers 5
MaxSpareServers 20
StartServers 10

 

3. 启动 TinyProxy

systemctl start tinyproxy.service

更多命令如下:

systemctl restart tinyproxy.service
systemctl stop tinyproxy.service
systemctl status tinyproxy.service
systemctl enable tinyproxy.service

 

4. 关闭防火墙或开放端口访问

那怎么开启一个端口呢
添加
firewall-cmd –zone=public –add-port=8888/tcp –permanent    (–permanent永久生效,没有此参数重启后失效)
重新载入
firewall-cmd –reload
查看
firewall-cmd –zone= public –query-port=8888/tcp
删除
firewall-cmd –zone= public –remove-port=8888/tcp –permanent

作者 admin

发表评论

您的电子邮箱地址不会被公开。