在使用HTTP代理服务器访问和管理云服务之前,您需要配置环境变量http_proxy和https_proxy。

OSS产品配置代理请参考:OSS命令配置代理

配置http_proxy环境变量

选择您系统对应的配置方式,并执行类似如下命令,配置http_proxy环境变量。

  • Linux/Unix和macOS:
    export http_proxy=http://192.168.1.2:1234
    export http_proxy=http://proxy.example.com:1234
  • Windows:
    set  http_proxy=http://192.168.1.2:1234
    set  http_proxy=http://proxy.example.com:1234
    说明 setx命令表示设置永久环境变量。设置完成后,需要重启终端。

配置https_proxy环境变量

选择您系统对应的配置方式,并执行类似如下命令,配置https_proxy环境变量。

  • Linux、macOS和Unix:
    export https_proxy=http://192.168.1.2:5678
    export https_proxy=http://proxy.example.com:5678
  • Windows:
    set https_proxy=http://192.168.1.2:5678
    set https_proxy=http://proxy.example.com:5678 

OSS命令配置代理

针对于OSS命令,无法通过环境变量配置代理,可以使用以下选项进行代理配置:

--proxy-host        网络代理服务器的url地址,支持http/https/socks5,比如 https://120.79.XX.XX:3128, socks5://120.79.XX.XX:1080
--proxy-user        网络代理服务器的用户名,默认为空
--proxy-pwd         网络代理服务器的密码,默认为空

例如:

aliyun oss ls oss://<Bucket> --proxy-host <YourProxyHost> --proxy-user <UserName> --proxy-pwd <Password>