我想用代理下载一些wget的东西:

HTTP Proxy: 127.0.0.1
Port: 8080

代理不需要用户名和密码。

我该怎么做呢?


当前回答

在Windows中——比如Fiddler——使用环境变量:

set http_proxy=http://127.0.0.1:8888
set https_proxy=http://127.0.0.1:8888

其他回答

Wget使用环境变量,像这样在命令行可以工作:

export http_proxy=http://your_ip_proxy:port/
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export dns_proxy=$http_proxy
export rsync_proxy=$http_proxy
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"

通过/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 ...

在我的ubuntu中,跟随$HOME/中的行。Wgetrc成功了!

Http_proxy = http://uname:passwd@proxy.blah.com:8080 Use_proxy = on

如果你只需要用代理执行一次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

在文件~/中添加以下行。Wgetrc或/etc/wgetrc(如果没有,创建文件):

http_proxy = http://[Proxy_Server]:[port]
https_proxy = http://[Proxy_Server]:[port]
ftp_proxy = http://[Proxy_Server]:[port]

欲了解更多信息,请访问https://www.thegeekdiary.com/how-to-use-wget-to-download-file-via-proxy/