0°

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. 关闭防火墙或开放端口访问

方式1:关闭防火墙

/etc/init.d/iptables stop

方式2:开放端口访问

iptables -A INPUT -p tcp –dport 8888 -j ACCEPT

重启防火墙

/etc/init.d/iptables restart

注意:若采用的阿里云、腾讯云、AWS等云服务器,记得要在安全策略里开放端口号

 

5. 验证生效

1)命令行测试验证

curl 和 wget 测试使用代理,请参考米扑代理的使用示例,总结的非常全面!强烈推荐!

这里,直接使用米扑代理的最简单示例:

curl -m 30 –retry 3 -x http://58.87.90.149:8888 http://proxy.mimvp.com/exist.php | grep ‘color=”red”‘
<font color=”red”>58.87.90.149</font>
curl -m 30 –retry 3 -x http://58.87.90.149:8888 -k https://proxy.mimvp.com/exist.php | grep ‘color=”red”‘
<font color=”red”>58.87.90.149</font>

tinyproxy 支持 http 和 https 两种协议,经米扑代理测试,成功!

 

2)Firefox 插件测试

首先,安装 Proxy Switcher

其次,配置代理,如下图:

然后,访问米扑代理网站,验证代理

https://proxy.mimvp.com/exist.php

上图里,http_via 带有参数,要隐藏需要修改配置文件

vim /etc/tinyproxy/tinyproxy.conf

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

DisableViaHeader Yes

重启 tinyproxy

systemctl restart tinyproxy.service

 

Credit:CSDN博客

 

「点点赞赏,手留余香」

    还没有人赞赏,快来当第一个赞赏的人吧!
0 条回复 A 作者 M 管理员
    所有的伟大,都源于一个勇敢的开始!
欢迎您,新朋友,感谢参与互动!欢迎您 {{author}},您在本站有{{commentsCount}}条评论