Centos8 安装proxy代理

本次使用 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

 Centos8 安装proxy代理_第1张图片

 

其他机器访问

export https_proxy=http://user123:[email protected]:18888

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

你可能感兴趣的:(linux,技能,git,proxy,centos8)