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

HTTP Proxy: 127.0.0.1
Port: 8080

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

我该怎么做呢?


当前回答

在文件~/中添加以下行。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/

其他回答

在文件~/中添加以下行。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/

在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"

在命令行输入:

$ export http_proxy=http://proxy_host:proxy_port

对于已验证的代理,

$ export http_proxy=http://username:password@proxy_host:proxy_port

然后运行

$ wget fileurl

对于https,只需使用https_proxy而不是http_proxy。您还可以将这些行放在~/中。Bashrc文件,这样你就不需要每次都执行了。

在尝试了许多教程之后,我的Ubuntu 16.04 LTS在一个经过身份验证的代理后,它按照以下步骤工作:

编辑 /etc/wgetrc:

$ sudo nano /etc/wgetrc

取消注释以下几行:

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

将http://proxy.yoyodyne.com:18023/修改为http://username:password@domain:port/

重要提示:如果它仍然不工作,检查您的密码是否有特殊字符,如#,@,…如果是这种情况,则转义它们(例如,将passw@rd替换为passw%40rd)。