代理服务器选择使用tinyproxy开源工具,轻量级,简单好用。下面是搭建步骤:
环境:
centos7
tinyproxy
1. 下载tinyproxy
yum install tinyproxy -y
2. 修改配置
vim /etc/tinyproxy/tinyproxy.conf
# 端口
Port 8888
# 允许访问的ip,后面接允许的ip,比如我只需要我阿里云的公网ip能访问就行,于是用阿里云公网ip替换127.0.0.1。如果要所有ip均可访问就注释掉此配置
Allow 127.0.0.1
# 性能配置,一般不需要修改,根据需要进行调整。(这里我没有修改)
MaxClients 100
MinSpareServers 5
MaxSpareServers 20
StartServers 10
MaxRequestsPerChild 0
MaxRequestsPerChild 0
3. 启动服务
systemctl start tinyproxy
4. 开放端口
firewall-cmd --add-port=8888/tcp --permanent # 开发的端口为你上面配置的端口
firewall-cmd --reload
5. 使用浏览器测试代理是否能正常使用
以chrome为例,点击设置 --> 高级 --> 打开代理设置。 进入如下配置,将代理服务器的ip和port填写进去即可。
。
然后测试一些能否正常上网,能即正常代理
OK。到此便完成了代理服务器的搭建。
————————————————
版权声明:本文为CSDN博主「Amos_x」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_41004350/article/details/79986309
补充一段(可行):
二、安装tinyproxy
sudo apt-get install tinyproxy
三、配置tinyproxy,修改Allow 127.0.0.1为自己IP,只允许自己使用,或者在Allow前面打#注释,允许任何IP都可以连接
vim /etc/tinyproxy.conf
四、启动Tinyproxy服务,并设置开机自启
sudo chkconfig --level 345 tinyproxy on
sudo systemctl restart tinyproxy.service
sudo systemctl enable tinyproxy.service
系统启动后,得执行一次
sudo service tinyproxy restart
五、防火墙开放8888(或已经自定义)端口
sudo iptables -I INPUT -p tcp --dport 8888 -j ACCEPT
#centos7如下设置:
sudo firewall-cmd --zone=public --add-port=8888/tcp --permanent
sudo firewall-cmd --reload
最后启动tinyport,设置开机启动
systemctl restart tinyproxy.service
systemctl enable tinyproxy.service
评论