暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

在Centos服务器搭建tinyproxy代理,解决内网无法上网问题、可以正常使用curl和wget【测试成功】

巴韭特锁螺丝 2025-02-16
59
一、需求背景
    在内网环境中,有且只有一台服务器可以访问外网,现在需要在该服务器搭建代理服务,以便其他服务器通过该服务器也能访问到外部网络、可以使用yum源安装软件。
二、服务端配置
        可以采用任意一款代理软件,本次以tinyproxy为例进行操作。
1、安装(如果安装不了则需要先配置epel源)
    yum -y install tinyproxy
 2、 初始化安装配置
 vim etc/tinyproxy/tinyproxy.conf

    修改port端口号以及注释掉以下内容

    #Allow 127.0.0.1


    取消注释以下内容:

      DisableViaHeader Yes

      systemctl start tinyproxy.service

      systemctl restart tinyproxy.service 

      systemctl status tinyproxy.service 

      systemctl enable tinyproxy.service 

      ps -ef | grep tinyproxy 

      三、客户端配置

      1、修改环境变量,增加以下配置

          # vim ~/.bashrc

        export http_proxy="10.18.10.63:18899"
        export https_proxy="10.18.10.63:18899"
        export ftp_proxy=$http_proxy


        2、使其生效:# source ~/.bashrc
        四、网络验证
          [root@wqcycdldp1 app]#  curl https://mirrors.huaweicloud.com/docker-ce/repodata/repomd.xml
          <html>
          <head>
                  <meta http-equiv="content-type" content="text/html;charset=utf-8">
                  <title>404</title>
          </head>
          <body>
                  <center>
                          <h1>404 Not Found</h1>
                  </center>
                  <hr>
                  <center>访问华为云开源镜像站,获取更多信息:<a href='https://mirrors.huaweicloud.com/'>https://mirrors.huaweicloud.com/</a></center>
          </body>


            [root@wqcycdldp1 app]# wget -i https://cdn.mysql.com/archives/mysql-8.4/mysql-community-debuginfo-8.4.2-1.el7.x86_64.rpm 
            --2024-12-11 10:30:45--  https://cdn.mysql.com/archives/mysql-8.4/mysql-community-debuginfo-8.4.2-1.el7.x86_64.rpm
            正在连接 10.18.10.63:18899... 已连接。
            已发出 Proxy 请求,正在等待回应... 200 OK
            长度:568523520 (542M) [application/x-redhat-package-manager]
            正在保存至: “mysql-community-debuginfo-8.4.2-1.el7.x86_64.rpm”
            30% [======================>                                                        ] 171,112,752 8.25MB/s 剩余 48s    ^C





            文章转载自巴韭特锁螺丝,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

            评论