From e64fbfe9b4e0abf893713c848aa38a9b07af8207 Mon Sep 17 00:00:00 2001 From: 8ga Date: Thu, 5 Mar 2026 11:17:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Ubuntu=E9=85=8D=E7=BD=AEHT?= =?UTF-8?q?TP=E4=BB=A3=E7=90=86=E6=9C=8D=E5=8A=A1=E5=99=A8.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ubuntu配置HTTP代理服务器.md | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Ubuntu配置HTTP代理服务器.md diff --git a/Ubuntu配置HTTP代理服务器.md b/Ubuntu配置HTTP代理服务器.md new file mode 100644 index 0000000..80678f2 --- /dev/null +++ b/Ubuntu配置HTTP代理服务器.md @@ -0,0 +1,46 @@ +## 普通用户 + +```bash +nano ~/.bashrc +``` + +``` +# Proxy Configuration +export HTTP_PROXY="http://192.168.31.9:7890" +export HTTPS_PROXY="http://192.168.31.9:7890" +export http_proxy="http://192.168.31.9:7890" +export https_proxy="http://192.168.31.9:7890" + +# 可选:设置不走代理的地址 (本地地址和内部域名) +export NO_PROXY="localhost,127.0.0.1,::1,192.168.*,10.*" +export no_proxy="localhost,127.0.0.1,::1,192.168.*,10.*" +``` + +保存并退出(`Ctrl + O` `Enter` `Ctrl + X`) + +```bash +source ~/.bashrc +``` + +## 对所有用户生效 + +```bash +sudo nano /etc/environment +``` + +``` +HTTP_PROXY="http://192.168.31.9:7890" +HTTPS_PROXY="http://192.168.31.9:7890" +http_proxy="http://192.168.31.9:7890" +https_proxy="http://192.168.31.9:7890" +NO_PROXY="localhost,127.0.0.1,::1" +no_proxy="localhost,127.0.0.1,::1" +``` + +保存并退出(`Ctrl + O` `Enter` `Ctrl + X`) + +```bash +sudo reboot +``` + +重启系统才能生效 \ No newline at end of file