当前位置:网站首页>为wget命令设置代理
为wget命令设置代理
2020-11-09 11:37:00 【xxjbs001】
为wget命令设置代理
实验环境:ubuntu 12.04 LTS goagent
方法一、在环境变量中设置代理
export http_proxy=http://127.0.0.1:8087
方法二、使用配置文件
为wget使用代理,可以直接修改/etc/wgetrc,也可以在主文件夹下新建.wgetrc,并编辑相应内容,本文采用后者。
将/etc/wgetrc中与proxy有关的几行复制到~/.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://127.0.0.1:8087/
http_proxy = http://127.0.0.1:8087/
ftp_proxy = http://127.0.0.1:8087/
# If you do not want to use proxy at all, set this to off.
use_proxy = on

这里 use_proxy = on 开启了代理,如果不想使用代理,每次都修改此文件未免麻烦,我们可以在命令中使用-Y参数来临时设置:
-Y, --proxy=on/off 打开或关闭代理
方法三、使用-e参数
wget本身没有专门设置代理的命令行参数,但是有一个"-e"参数,可以在命令行上指定一个原本出现在".wgetrc"中的设置。于是可以变相在命令行上指定代理:
-e, --execute=COMMAND 执行`.wgetrc'格式的命令
例如:
wget -c -r -np -k -L -p -e "http_proxy=http://127.0.0.1:8087" http://www.subversion.org.cn/svnbook/1.4/
这种方式对于使用一个临时代理尤为方便。
注: 如果是https,则参数为:-e "https_proxy=http://127.0.0.1:8087"
使用https时如果想要忽略服务器端证书的校验,可以使用 -k 参数。
版权声明
本文为[xxjbs001]所创,转载请带上原文链接,感谢
https://my.oschina.net/xxjbs001/blog/4709094
边栏推荐
猜你喜欢
彩虹排序 | 荷兰旗问题
Program life: from Internet addicts to Microsoft, bat and byte offer harvesters
百亿级数据分表后怎么分页查询?
Five indispensable open source tools for me
A simple ability determines whether you will learn!
Android rights
How to query by page after 10 billion level data is divided into tables?
Dynamo: a typical distributed system analysis
Complete set of linked list operations of data structure and algorithm series (3) (go)
Graph node classification and message passing
随机推荐
After SQL group query, get the first n records of each group
美国大选拜登获胜!硅谷的Python开发者用这种方式调侃懂王
大型项目Objective-C - NSURLSession接入短信验证码应用实例分享
Visual Studio (MAC) installation process notes
Rainbow sorting | Dutch flag problem
Python zero basics tutorial (01)
实现商品CRUD操作
使用rem,做到屏幕缩放时,字体大小随之改变
An attempt to read or write to protected memory occurred using the CopyMemory API. This usually indicates that other memory is corrupted.
Configure switch trunk interface traffic local priority forwarding (cluster / stack)
理解Task和和async await
Ten year itch of programmer
GLSB涉及负载均衡算法
Explain Python input() function: get user input string
[design pattern] Chapter 4: Builder mode is not so difficult
微信视频号播主排行榜2020年10月
微信圈子
A simple ability determines whether you will learn!
Commodity management system -- integrate warehouse services and obtain warehouse list
Three ways to operate tables in Apache iceberg