APT 代理配置
最近遇到 APT 连不上 docker 源的问题,需要配置 APT 的代理。
创建 /etc/apt/apt.conf.d/50proxy.conf 文件,填入代理配置:
1Acquire::http::Proxy "http://ADDRESS:PORT";最近遇到 APT 连不上 docker 源的问题,需要配置 APT 的代理。
创建 /etc/apt/apt.conf.d/50proxy.conf 文件,填入代理配置:
1Acquire::http::Proxy "http://ADDRESS:PORT";编辑 ~/.cargo/config 文件:
1# 将 crates-io 替换为中科大镜像
2[source.crates-io]
3registry = "https://github.com/rust-lang/crates.io-index"
4replace-with = 'ustc'1git config --global http.proxy socks://localhost:7890HTTP 和 HTTPS 都使用
http.proxy,不存在名为https.proxy的配置。
首先要区分的是代理类型中 http 和代理地址中 http 含义的区别。
前者表示 HTTP 协议的传输使用的代理,而后者表示代理使用协议。两者之间并没有任何联系。
例如:
http_proxy="http://localhost:7890 表示 HTTP 协议的传输通过 localhost 的 7890 端口进行代理,代理协议为 HTTP。
https_proxy="http://localhost:7890 表示 HTTPS 协议的传输通过 localhost 的 7890 端口进行代理,代理协议为 HTTP。
KDE 的系统设置中已经提示了,一些应用程序可能不会使用这个代理。因为在 Linux 上有很多配置代理的方式,不同的应用程序可能读取了不同的配置。 而 KDE 的系统设置使用的是自家的 KConfig,基本只有 KDE 自己支持,很少有其他应用程序兼容。
1$ kreadconfig5 --file kioslaverc --group 'Proxy Settings' --key httpProxy
2localhost 7890
3
4$ cat /home/planc/.config/kioslaverc 1# 当前用户
2npm config set registry https://registry.npmmirror.com
3
4# ROOT
5sudo npm config set registry https://registry.npmmirror.comWindows 平台上配置文件路径如下:
%appdata%\Parsec\config.txt%ProgramData%\Parsec\config.txt在配置文件中写入代理配置:
1app_proxy = true以 Docker 为例,创建或编辑 /etc/systemd/system/docker.service.d/http-proxy.conf 文件,写入以下内容:
1[Service]
2Environment="ALL_PROXY=http://192.168.1.100:7890"
3Environment="HTTP_PROXY=http://192.168.1.100:7890"
4Environment="HTTPS_PROXY=http://192.168.1.100:7890"1git clone https://github.com/Dreamacro/clash.git
2cd clash
3go build
4sudo cp clash /usr/bin