curl代理¶
命令行¶
http/https代理¶
命令行
curl可以直接使用代理:curl https://reqbin.com/echo -x myproxy.com:8080 -U login:password
举例,我在 Node.js开发环境 需要安装 nvm ,但是 raw.githubusercontent.com 被墙,所以需要通过以下命令通过代理访问:
curl -x 192.168.10.9:3128 -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
socks5代理¶
命令行
curl可以使用socks5h方式:curl -x socks5h://localhost:1080 -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
持久化配置¶
http/https代理¶
环境变量设置:
export http_proxy=http://192.168.10.9:3128 export https_proxy=$http_proxy
或者采用
~/.curlrcproxy=192.168.10.9:3128
socks5代理¶
比较特别,对于socks代理,变量是使用全部大写字母:
配置curl的socks5代理环境变量¶
export ALL_PROXY=socks5h://localhost:1080