How to set proxy for wget?

后端 未结 13 1859
陌清茗
陌清茗 2020-12-02 03:38

I want to download something with wget using a proxy:

HTTP Proxy: 127.0.0.1
Port: 8080

The proxy does not need username and pa

相关标签:
13条回答
  • 2020-12-02 04:18
    export http_proxy=http://proxy_host:proxy_port/
    export https_proxy=https://proxy_host:proxy_port/
    

    or

    export http_proxy=http://username:password@proxy_host:proxy_port/
    export https_proxy=https://username:password@proxy_host:proxy_port/
    

    As all others explained here, these environment variable helps to pass on proxies.

    Note: But please not that if the password contains any special character then that needs to be configured as %<hex_value_of_special_char>.

    Example: If the password is pass#123, need to be used as pass%23123 in above export commands.

    0 讨论(0)
  • 2020-12-02 04:20

    After trying many tutorials to configure my Ubuntu 16.04 LTS behind a authenticated proxy, it worked with these steps:

    Edit /etc/wgetrc:

    $ sudo nano /etc/wgetrc
    

    Uncomment these lines:

    #https_proxy = http://proxy.yoyodyne.com:18023/
    #http_proxy = http://proxy.yoyodyne.com:18023/
    #ftp_proxy = http://proxy.yoyodyne.com:18023/
    #use_proxy = on
    

    Change http://proxy.yoyodyne.com:18023/ to http://username:password@domain:port/

    IMPORTANT: If it still doesn't work, check if your password has special characters, such as #, @, ... If this is the case, escape them (for example, replace passw@rd with passw%40rd).

    0 讨论(0)
  • 2020-12-02 04:22

    In Debian Linux wget can be configured to use a proxy both via environment variables and via wgetrc. In both cases the variable names to be used for HTTP and HTTPS connections are

    http_proxy=hostname_or_IP:portNumber
    https_proxy=hostname_or_IP:portNumber
    

    Note that the file /etc/wgetrc takes precedence over the environment variables, hence if your system has a proxy configured there and you try to use the environment variables, they would seem to have no effect!

    0 讨论(0)
  • 2020-12-02 04:22

    In Ubuntu 12.x, I added the following lines in $HOME/.wgetrc

    http_proxy = http://uname:passwd@proxy.blah.com:8080

    use_proxy = on

    0 讨论(0)
  • 2020-12-02 04:27

    In Windows - for Fiddler say - using environment variables:

    set http_proxy=http://127.0.0.1:8888
    set https_proxy=http://127.0.0.1:8888
    
    0 讨论(0)
  • 2020-12-02 04:28

    start wget through socks5 proxy using tsocks:

    1. install tsocks: sudo apt install tsocks
    2. config tsocks

      # vi /etc/tsocks.conf
      
      server = 127.0.0.1
      server_type = 5
      server_port = 1080
      
    3. start: tsocks wget http://url_to_get
    0 讨论(0)
提交回复
热议问题