我想用代理下载一些wget的东西:
HTTP Proxy: 127.0.0.1
Port: 8080
代理不需要用户名和密码。
我该怎么做呢?
我想用代理下载一些wget的东西:
HTTP Proxy: 127.0.0.1
Port: 8080
代理不需要用户名和密码。
我该怎么做呢?
当前回答
在Ubuntu 12中。x,我在$HOME/.wgetrc中添加了以下行
Http_proxy = http://uname:passwd@proxy.blah.com:8080 Use_proxy = on
其他回答
以下可能的配置位于/etc/wgetrc,只需取消注释并使用…
# You can set the default proxies for Wget to use for http, https, and ftp.
# They will override the value in the environment.
#https_proxy = http://proxy.yoyodyne.com:18023/
#http_proxy = http://proxy.yoyodyne.com:18023/
#ftp_proxy = http://proxy.yoyodyne.com:18023/
# If you do not want to use proxy at all, set this to off.
#use_proxy = on
通过/etc/wgetrc对系统的所有用户或仅对用户使用~/。wgetrc文件:
use_proxy=yes
http_proxy=127.0.0.1:8080
https_proxy=127.0.0.1:8080
或者在URL后加上-e选项:
wget ... -e use_proxy=yes -e http_proxy=127.0.0.1:8080 ...
如果你只需要用代理执行一次wget,最简单的方法是用这样的一行程序来执行:
http_proxy=http://username:password@proxy_host:proxy_port wget http://fileurl
或使用https目标URL:
https_proxy=http://username:password@proxy_host:proxy_port wget https://fileurl
在Debian Linux中,wget可以通过环境变量和wgetrc配置为使用代理。在这两种情况下,用于HTTP和HTTPS连接的变量名是
http_proxy=hostname_or_IP:portNumber
https_proxy=hostname_or_IP:portNumber
请注意,文件/etc/wgetrc优先于环境变量,因此,如果您的系统在那里配置了代理,并且尝试使用环境变量,它们似乎没有任何影响!
使用tsocks通过socks5代理启动wget:
Install tsocks: sudo apt Install tsocks 配置tsocks # vi /etc/tsocks.conf Server = 127.0.0.1 Server_type = 5 Server_port = 1080 开始:tsocks wget http://url_to_get