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

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
相关推荐
-
PHP8种变量类型的详细讲解2025-02-22 00:32:24
-
php+apache 和 php+nginx的区别2025-02-22 00:21:27
-
PHP:与workerman结合实现定时任务2025-02-22 00:15:57
-
Nginx的Rewrite规则与实例2025-02-22 00:15:39
-
MySql中身份证字段的简单脱敏介绍2025-02-22 00:15:36