Question: While downloading using wget, I get the following error “Connecting to <URL>.. failed: Connection refused.”. I’m behind a proxy server. How do I fix it?
Answer: Export the http_proxy variable with your proxy server name or ip address and then try downloading as explained below.
Connection refused error while using wget
If http_proxy environment variable is not set, you might receive the following message while downloading files from Internet using wget.
$ wget -O DrawIt.vba.gz http://www.vim.org/scripts/download_script.php?src_id=8798
--12:58:32-- http://www.vim.org/scripts/download_script.php?src_id=8798
=> `DrawIt.vba.gz'
Resolving www.vim.org... 216.34.181.97
Connecting to www.vim.org|216.34.181.97|:80... failed: Connection refused.
Export HTTP_PROXY Variable
Specify your proxy server name (or) ip-address (along with any port number if necessary) in the http_proxy variable as shown below.
$ export http_proxy='proxy_server_ip:8080'
Use colon ( : ) as delimiter between ip/host and port number. Following is an example.
$ export http_proxy='http://myproxy.cmp.com:8080/'
Now, you should be able to download using wget without any issue.
$ wget -O DrawIt.vba.gz http://www.vim.org/scripts/download_script.php?src_id=8798 --12:59:02-- http://www.vim.org/scripts/download_script.php?src_id=8798 => `DrawIt.vba.gz' Resolving proxy.sgp.hp.com... 16.158.235.10 Connecting to proxy.sgp.hp.com|16.158.235.10|:8080... connected. Proxy request sent, awaiting response... 200 OK Length: unspecified [application/octetstream] [ ] 21,668 --.--K/s 12:59:04 (164.19 KB/s) - `DrawIt.vba.gz' saved [21668]
Comments on this entry are closed.
Also su can use this configuration for ftp proxy
export ftp_proxy=’http://myproxy.cmp.com:8080/’
I forget it you can avoid http_proxy for some local or intranet sites with:
export no_proxy=localhost,127.0.0.0/8,*.local,*.foo.com,192.168.1.0/24,*.foo.corp.com
You can copy wget configuration from /etc/wgetrc to your_home/.wgetrc
Edit and change http_proxy configuration.
Hi group,
I have a straight forward question. I have ftp proxy’s link, user id and password. Then I have ftp site’s link, user id and password. Can I have some unix shell script that uses all this information and wget to download the files from the ftp site?
Thanks very much for your help.
Abhijat.
[root@hostname ~]# wget http://domainname/text.txt
–2012-10-26 06:13:45– http://domainname/text.txt
Resolving …
Connecting to ||:80… failed: Connection timed out.
Retrying.