Programing

wget에 프록시를 설정하는 방법은 무엇입니까?

lottogame 2020. 5. 8. 08:15
반응형

wget에 프록시를 설정하는 방법은 무엇입니까?


wget프록시 사용하여 무언가를 다운로드하고 싶습니다 .

HTTP Proxy: 127.0.0.1
Port: 8080

프록시에는 사용자 이름과 비밀번호가 필요하지 않습니다.

어떻게해야합니까?


파일 /etc/wgetrc을 사용하는 사용자 또는 ~/.wgetrc파일 통해 시스템의 모든 사용자의 경우 :

use_proxy=yes
http_proxy=127.0.0.1:8080
https_proxy=127.0.0.1:8080

또는 -eURL 뒤에 배치 된 옵션을 통해 :

wget ... -e use_proxy=yes -e http_proxy=127.0.0.1:8080 ...

명령 행에 입력하십시오.

$ export http_proxy=http://proxy_host:proxy_port

인증 된 프록시의 경우

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

그런 다음 실행

$ wget fileurl

https의 경우 http_proxy 대신 https_proxy를 사용하십시오. ~ / .bashrc 파일에이 줄을 넣어서 매번 실행할 필요가 없도록 할 수도 있습니다.


다음 가능한 구성은 /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

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"

인증 된 프록시 뒤에 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@rdpassw%40rd).


Ubuntu 12.x에서 $ HOME / .wgetrc에 다음 줄을 추가했습니다.

http_proxy = http : // uname : passwd@proxy.blah.com : 8080

use_proxy = 켜기


데비안 리눅스에서 환경 변수와 wgetrc를 통해 프록시를 사용하도록 wget을 구성 할 수 있습니다. 두 경우 모두 HTTP 및 HTTPS 연결에 사용되는 변수 이름은 다음과 같습니다.

http_proxy=hostname_or_IP:portNumber
https_proxy=hostname_or_IP:portNumber

/ etc / wgetrc 파일은 환경 변수보다 우선합니다. 따라서 시스템에 프록시가 구성되어 있고 환경 변수를 사용하려고하면 효과가없는 것 같습니다!


In my ubuntu, following lines in $HOME/.wgetrc did the trick!

http_proxy = http://uname:passwd@proxy.blah.com:8080

use_proxy = on


export http_proxy=http://proxy_host:proxy_port/
export https_proxy=https://proxy_host:proxy_port/

or

export http_proxy=http://username:password@proxy_host:proxy_port/
export https_proxy=https://username:password@proxy_host:proxy_port/

As all others explained here, these environment variable helps to pass on proxies.

Note: But please not that if the password contains any special character then that needs to be configured as %<hex_value_of_special_char>.

Example: If the password is pass#123, need to be used as pass%23123 in above export commands.


In Windows - for Fiddler say - using environment variables:

set http_proxy=http://127.0.0.1:8888
set https_proxy=http://127.0.0.1:8888

If you need to execute wget just once with the proxy, the easiest way is to do it with a one-liner like this:

http_proxy=http://username:password@proxy_host:proxy_port wget http://fileurl

or with an https target URL:

https_proxy=http://username:password@proxy_host:proxy_port wget https://fileurl

Add below line(s) in file ~/.wgetrc or /etc/wgetrc (create the file if it is not there):

http_proxy = http://[Proxy_Server]:[port]
https_proxy = http://[Proxy_Server]:[port]
ftp_proxy = http://[Proxy_Server]:[port]

For more information, https://www.thegeekdiary.com/how-to-use-wget-to-download-file-via-proxy/

참고URL : https://stackoverflow.com/questions/11211705/how-to-set-proxy-for-wget

반응형