当前位置:网站首页>为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
边栏推荐
- [design pattern] Chapter 4: Builder mode is not so difficult
- 【译】npm developer guide
- 未来中国电信将把云计算服务打造成为中国电信的主业
- Understanding task and async await
- GitHub 上适合新手的开源项目(Python 篇)
- Gather in Beijing! Openi / O 2020 Qizhi Developer Conference enters countdown
- range_sensor_layer
- 用一种简单的方式实现终端文字粘贴板
- JT-day09
- Handwriting Koa.js Source code
猜你喜欢
随机推荐
手写数字图片识别-卷积神经网络
After SQL group query, get the first n records of each group
商品管理系统——商品新增本地保存实现部分
Learning notes of nodejs
接口测试如何在post请求中传递文件
Rainbow sorting | Dutch flag problem
Handwritten digital image recognition convolution neural network
走进京东 | 中国空间技术研究院青年创新联盟成员莅临参观京东总部
一个简单的能力,决定你是否会学习!
el-table动态表头
手写Koa.js源码
向北京集结!OpenI/O 2020启智开发者大会进入倒计时
嘉宾专访|2020 PostgreSQL亚洲大会阿里云数据库专场:樊文凯
As a user, you can't get rid of the portrait!
推荐系统,深度论文剖析GBDT+LR
如何保证消息不被重复消费?(如何保证消息消费的幂等性)
Review of hot spots of last week (11.2-11.8)
From the practice, this paper discusses the problems caused by the inconsistent design of ruby syntax.
零基础IM开发入门(四):什么是IM系统的消息时序一致性?
EFF 认为 RIAA 正在“滥用 DMCA”来关闭 YouTube-DL






