zoukankan      html  css  js  c++  java
  • CentOS搭建代理服务器

    • 服务器情况
    有A、B、C三台服务器,都在同一个网段,AB不可联网,C可连接互联网。
    

    搭建过程

    1. C 服务器搭建代理服务器
    yum -y install tinyproxy
    
    vim /etc/tinyproxy/tinyproxy.conf
    

    修改代理服务器端口为8899

    Port 8888
    

    注释

    #Allow 127.0.0.1
    

    去掉注释

    DisableViaHeader Yes
    

    启动启动 TinyProxy

    systemctl start tinyproxy.service
    

    更多命令

    systemctl restart tinyproxy.service 
    systemctl stop tinyproxy.service 
    systemctl status tinyproxy.service 
    systemctl enable tinyproxy.service 
    

    关闭防火墙或开放端口访问

    /etc/init.d/iptables stop
    

    开放端口访问

    iptables -A INPUT -p tcp --dport 8888 -j ACCEPT
    

    重启防火墙

    /etc/init.d/iptables restart
    

    A、B服务器Teelnet C 8899端口测试

    1. A、B服务器设置代理上网

    编辑~/.bashrc

    ~/.bashrc
    

    添加

    # add proxy for network
    export http_proxy="192.168.0.3:8899"
    export https_proxy="192.168.0.3:8899"
    export ftp_proxy=$http_proxy
    

    刷新环境变量

    source ~/.bashrc
    

    测试A、B连接互联网

    curl www.baidu.com
    
    • Docker 设置代理

    创建配置文件

    mkdir -p /etc/systemd/system/docker.service.d
    vi /etc/systemd/system/docker.service.d/http-proxy.conf
    

    编辑配置文件(新增如下内容)

    [Service]
    Environment="HTTP_PROXY=10.10.17.20:8899"
    Environment="NO_PROXY=localhost,127.0.0.0/8,*.mirror.aliyuncs.com"
    

    重启

    systemctl daemon-reload
    systemctl restart docker
    systemctl show docker --property Environment
    
  • 相关阅读:
    归并排序
    mysql优化
    树结构
    urllib库的使用
    linux常用命令
    mysql慢查询
    支付宝第三方支付
    类型(type)判断
    c语言自带的排序与查找
    多字节与宽字节转换
  • 原文地址:https://www.cnblogs.com/6324/p/12516047.html
Copyright © 2011-2022 走看看