当前位置:网站首页>为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
边栏推荐
- For and for... In, for each and map and for of
- SQL第二章第三章
- 理解Task和和async await
- 大型项目Objective-C - NSURLSession接入短信验证码应用实例分享
- 从实践谈 Ruby 语法上的几个设计不一致带来的问题。
- 商品管理系统——商品新增本地保存实现部分
- Safety (miscellany)
- Mac 终端(terminal) oh-my-zsh+solarized配置
- Start learning discrete mathematics again
- The whole process of building a fully distributed cluster
猜你喜欢

理解 OC 中 RunLoop

Configure switch trunk interface traffic local priority forwarding (cluster / stack)

Shoes? Forecasting stock market trends? Taobao second kill? Python means what you want

From the practice, this paper discusses the problems caused by the inconsistent design of ruby syntax.

Front end code style practice prettier + eslint + git hook + lint staged

Reading design patterns adapter patterns

Handwriting Koa.js Source code

SQL statement to achieve the number of daffodils

JT-day09

Biden wins the US election! Python developers in Silicon Valley make fun of Ku Wang in this way
随机推荐
Wealth and freedom? Ant financial services suspended listing, valuation or decline after regulation
Handwriting Koa.js Source code
JT-day09
Android 复选框 以及回显
手写Koa.js源码
Glsb involves load balancing algorithm
医疗项目管理的三种实用技巧
Composition - API
jsliang 求职系列 - 08 - 手写 Promise
Commodity management system -- implementation of local preservation of new commodities
【QT】子类化QThread实现多线程
Aren't you curious about how the CPU performs tasks?
VisualStudio(Mac)安装过程笔记
使用rem,做到屏幕缩放时,字体大小随之改变
How to ensure that messages are not consumed repeatedly? (how to ensure the idempotent of message consumption)
Front end code style practice prettier + eslint + git hook + lint staged
Principle analysis and performance tuning of elasticsearch
日志分析工具 - GoAccess
ThinkPHP门面源码解析
做用户,绕不开画像!