Hak*_*kim 208 linux proxy wget
我想wget使用代理下载一些东西:
HTTP Proxy: 127.0.0.1
Port: 8080
Run Code Online (Sandbox Code Playgroud)
代理不需要用户名和密码.
我怎样才能做到这一点?我查了很多网站和很多建议,但没有什么对我有用......
ama*_*ksr 389
对于系统的所有用户,通过/etc/wgetrc或仅为用户使用该~/.wgetrc文件:
use_proxy=yes
http_proxy=127.0.0.1:8080
https_proxy=127.0.0.1:8080
Run Code Online (Sandbox Code Playgroud)
或通过-eURL后面的选项:
wget ... -e use_proxy=yes -e http_proxy=127.0.0.1:8080 ...
Run Code Online (Sandbox Code Playgroud)
shi*_*nkr 78
输入命令行:
$ export http_proxy=http://proxy_host:proxy_port
Run Code Online (Sandbox Code Playgroud)
对于经过验证的代理,
$ export http_proxy=http://username:password@proxy_host:proxy_port
Run Code Online (Sandbox Code Playgroud)
然后跑
$ wget fileurl
Run Code Online (Sandbox Code Playgroud)
对于https,只需使用https_proxy而不是http_proxy.您也可以将这些行放在〜/ .bashrc文件中,这样您就不必每次都执行此操作.
hov*_*yan 36
以下可能的配置/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
Run Code Online (Sandbox Code Playgroud)
小智 19
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"
Run Code Online (Sandbox Code Playgroud)
Jan*_*lva 16
在尝试了许多教程以在经过身份验证的代理后面配置我的Ubuntu 16.04 LTS之后,它使用了以下步骤:
编辑/etc/wgetrc:
$ sudo nano /etc/wgetrc
Run Code Online (Sandbox Code Playgroud)
取消注释这些行:
#https_proxy = http://proxy.yoyodyne.com:18023/
#http_proxy = http://proxy.yoyodyne.com:18023/
#ftp_proxy = http://proxy.yoyodyne.com:18023/
#use_proxy = on
Run Code Online (Sandbox Code Playgroud)
更改http://proxy.yoyodyne.com:18023/到http://username:password@domain:port/
重要提示:如果仍然不能正常工作,请检查您的密码包含特殊字符,例如
#,@,...如果是这样的话,他们逃脱(例如,更换passw@rd用passw%40rd).
小智 6
在Ubuntu 12.x中,我在$ HOME/.wgetrc中添加了以下行
http_proxy = http:// uname:passwd@proxy.blah.com:8080
use_proxy = on
在我的ubuntu中,$ HOME / .wgetrc中的以下几行起到了作用!
http_proxy = http:// uname:passwd@proxy.blah.com:8080
use_proxy =开启
在Debian Linux中,可以将wget配置为通过环境变量和wgetrc使用代理。在这两种情况下,用于HTTP和HTTPS连接的变量名都是
http_proxy=hostname_or_IP:portNumber
https_proxy=hostname_or_IP:portNumber
Run Code Online (Sandbox Code Playgroud)
请注意,文件/ etc / wgetrc优先于环境变量,因此,如果您的系统在其中配置了代理,并且您尝试使用环境变量,则它们似乎无效!
使用
export http_proxy=http://proxy_host:proxy_port/
export https_proxy=https://proxy_host:proxy_port/
Run Code Online (Sandbox Code Playgroud)
或者
export http_proxy=http://username:password@proxy_host:proxy_port/
export https_proxy=https://username:password@proxy_host:proxy_port/
Run Code Online (Sandbox Code Playgroud)
正如此处所有其他人所解释的那样,这些环境变量有助于传递代理。
注意:但请注意,如果密码包含任何特殊字符,则需要将其配置为%<hex_value_of_special_char>。
示例:如果密码为,则需要按照上述导出命令pass#123使用。pass%23123
如果您只需要使用代理执行 wget 一次,最简单的方法是使用这样的单行程序:
http_proxy=http://username:password@proxy_host:proxy_port wget http://fileurl
Run Code Online (Sandbox Code Playgroud)
或使用 https 目标 URL:
https_proxy=http://username:password@proxy_host:proxy_port wget https://fileurl
Run Code Online (Sandbox Code Playgroud)
在文件~/.wgetrc或/etc/wgetrc中添加以下行(如果不存在则创建该文件):
http_proxy = http://[Proxy_Server]:[port]
https_proxy = http://[Proxy_Server]:[port]
ftp_proxy = http://[Proxy_Server]:[port]
Run Code Online (Sandbox Code Playgroud)
欲了解更多信息,https://www.thegeekdiary.com/how-to-use-wget-to-download-file-via-proxy/
| 归档时间: |
|
| 查看次数: |
534634 次 |
| 最近记录: |