Files
linux/Ubuntu配置HTTP代理服务器.md

44 lines
919 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 用户级别
```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
```