Centos8 安装proxy代理

32 篇文章 2 订阅

本次使用 tinyproxy/tinyproxy: tinyproxy - a light-weight HTTP/HTTPS proxy daemon for POSIX operating systems (github.com)

官方文档:Tinyproxy 

操作如下:

dnf install git -y
cd /opt/
git clone https://github.com/tinyproxy/tinyproxy.git

进行编译安装

./autogen.sh
make
make install

将配置文件拷贝到 /etc/目录

cp etc/tinyproxy.conf /etc/

添加basic授权

vim /etc/tinyproxy.conf

#修改下面配置,允许所有地址,添加basic授权

Port 18888

#Allow 127.0.0.1
#Allow ::1

# BasicAuth: HTTP "Basic Authentication" for accessing the proxy.
# If there are any entries specified, access is only granted for authenticated
# users.
BasicAuth user123 hahapwd

访问之前,记得给proxy服务放行 18888 端口 

服务启动

增加服务配置

vim /usr/lib/systemd/system/tinyproxy.service

内容如下

[Unit]
Description=Tinyproxy Server Service
After=network.target

[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=/usr/local/bin/tinyproxy -c etc/tinyproxy.conf -d

启动服务

systemctl start tinyproxy
systemctl status tinyproxy

 

 

其他机器访问

export https_proxy=http://user123:hahapwd@47.113.67.125:18888

 然后就可以通过curl进行测试了

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值