Linux系統下終端proxy代理配置

一、前言

1、工作中有時會遇到需要翻牆下載軟件的問題,這個時候就用到了正向代理。

2、正向代理服務器端的配置比較簡單,這裡不在重複說明,想了解的可以看作者的另一篇文章《nginx正向代理配置》,這裡只對終端代理的配置進行說明。

二、終端代理配置

2.1、代理變量的配置

Linux系統下終端proxy代理配置

2.2、變量的設置方法

a) 在 /etc/profile文件

b) 在 ~/.bashrc

c) 在 /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"

2.3、取消設置的方法

shell> unset http_proxy
shell> unset https_proxy
shell> unset ftp_proxy
shell> unset no_proxy

三、延伸閱讀

3.1、配置yum單獨代理

shell> echo "proxy=http://10.20.57.32:8080/" >> /etc/yum.conf

3.2、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"

3.3、subversion代理服務器配置

# 修改$HOME/.subversion/servers文件,在此文件的[global]段加上:
http-proxy-host = 192.168.1.1
http-proxy-port = 8080
http-proxy-username = 91donkey
http-proxy-password = 123456

3.4、其他支持http/https正向代理的proxy軟件

nginx

tinyproxy(簡單,支持http/https協議)

squid(穩定簡單,支持http/https協議)

3.5、squid 3.x正向代理proxy配置

shell> cat /etc/squid/squid.conf
http_access allow all
http_port 8443
cache deny all

作者:龍龍小寶

原文:https://www.cnblogs.com/91donkey/p/11640079.html


分享到:


相關文章: