• Linux系统下终端proxy代理配置


    一、前言

    1、工作中有时会遇到需要翻墙下载软件的问题,这个时候就用到了正向代理。
    2、正向代理服务器端的配置比较简单,这里不在重复说明,想了解的可以看作者的另一篇文章《nginx正向代理配置》,这里只对终端代理的配置进行说明。

    二、终端代理配置

    • 代理变量的配置

    • 变量的设置方法
      1、在 /etc/profile文件
      2、在 ~/.bashrc
      3、在 /etc/profile.d/文件夹下新建一个文件xxx.sh
      写入如下配置:

    export proxy="http://10.20.56.32:8000"
    export http_proxy=$proxy
    export https_proxy=$proxy
    export ftp_proxy=$proxy
    export no_proxy="localhost, 127.0.0.1, ::1"
    
    • 取消设置的方法
    shell> unset http_proxy
    shell> unset https_proxy
    shell> unset ftp_proxy
    shell> unset no_proxy
    

    三、延伸阅读

    • 配置yum单独代理
    shell> echo "proxy=http://10.20.57.32:8080/" >> /etc/yum.conf
    
    • php-fpm默认不加载系统的http/https proxy环境变量修改方法
    # 添加php-ftpm关于env的如下配置,然后重启php-fpm服务。
    env[http_proxy] = "http_proxy=http://1.1.1.1:8082" 
    env[https_proxy] = "https_proxy=http://1.1.1.1:8082"
    env[no_proxy] = "a.test.com,127.0.0.1,2.2.2.2"
    
    • subversion代理服务器配置
    # 修改$HOME/.subversion/servers文件,在此文件的[global]段加上:
    http-proxy-host = 192.168.1.1
    http-proxy-port = 8080 
    http-proxy-username = 91donkey
    http-proxy-password = 123456 
    
    • 其他支持http/https正向代理的proxy软件
      nginx
      tinyproxy(简单,支持http/https协议)
      squid(稳定简单,支持http/https协议)
    • squid 3.x正向代理proxy配置
    shell> cat /etc/squid/squid.conf
    http_access allow all
    http_port 8443
    cache deny all
    
  • 相关阅读:
    MVC.Net:Razor指定模板
    Intellij Idea 13:导入openfire源代码
    SharePoint 2013:解决爬网出错的问题
    MySQL:解决MySQL无法启动的问题
    SharePoint 2013:解决添加域名后每次都需要登录的问题
    Android 动画
    android:persistent属性
    ubuntu 安装 open in teminal
    利用python建表
    flask request
  • 原文地址:https://www.cnblogs.com/91donkey/p/11640079.html
Copyright © 2020-2023  润新知