TinyProxy-http代理搭建
1.安装TinyProxy
yum install -y epel-release
yum update -y
yum install -y tinyproxy
2.配置TinyProxy
(1)vi /etc/tinyproxy/tinyproxy.conf
修改两处配置:端口号和允许连接该代理的IP白名单:
User tinyproxy
Group tinyproxy
# http代理端口
Port 8888
Timeout 600
DefaultErrorFile "/usr/share/tinyproxy/default.html"
StatFile "/usr/share/tinyproxy/stats.html"
LogFile "/var/log/tinyproxy/tinyproxy.log"
LogLevel Info
PidFile "/var/run/tinyproxy/tinyproxy.pid"
MaxClients 100
MinSpareServers 5
MaxSpareServers 20
StartServers 10
MaxRequestsPerChild 0
ViaProxyName "tinyproxy"
#Allow 127.0.0.1 注释掉表示允许所有IP链接
ConnectPort 443
ConnectPort 563
(2)配置完后,重启TinyProxy
systemctl enable tinyproxy.service
systemctl restart tinyproxy.service
防火墙开放你的配置的代理端口:
iptables -I INPUT -p tcp --dport 8888 -j ACCEPT
3.验证TinyProxy
在另一台主机上运行以下命令检查是否用了代理:
curl -x 代理服务器IP地址:代理端口 httpbin.org/get
上图中访问httpbin.org/get得到的IP地址为:代理服务器IP地址,说明代理搭建成功。