添加 Ubuntu配置HTTP代理服务器.md
This commit is contained in:
46
Ubuntu配置HTTP代理服务器.md
Normal file
46
Ubuntu配置HTTP代理服务器.md
Normal file
@@ -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
|
||||
```
|
||||
|
||||
重启系统才能生效
|
||||
Reference in New Issue
Block a user