You are not logged in.

#1 2016-07-29 14:55:26

honeyplease
Member
Registered: 2013-09-07
Posts: 33

curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

I'm an extreme newbie when it comes to networking. I'm trying

 [~]$ curl -v 127.0.0.1
* Rebuilt URL to: 127.0.0.1/
*   Trying 127.0.0.1...
* connect to 127.0.0.1 port 80 failed: Connection refused
* Failed to connect to 127.0.0.1 port 80: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused
 

My /etc/hosts file:

 
[~]$ cat /etc/hosts 
#
# /etc/hosts: static lookup table for host names
#

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost   xxx 
::1             localhost.localdomain   localhost   xxx

# End of file
 

Telnet fails too:

 [~]$ telnet localhost 80
Trying ::1...
Connection failed: Connection refused
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
 

Any pointer to this horribly noob situation appreciated.

Offline

#2 2016-07-29 15:10:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,355
Website

Re: curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

Are you running apache or another web server on your machine?  Or are you running some other service listening on port 80?  If not, the above results are exactly as expected.  What are you actually trying to accomplish?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2016-07-29 16:02:57

honeyplease
Member
Registered: 2013-09-07
Posts: 33

Re: curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

I am not running any service, now I realize why my results are the expected behavior.

* facepalm

I'm trying to learn how to implement concurrent http post requests, and I thought a good first step was to learn how to emulate *one* http requests to my localhost... do I need to open a socket for that? I'm so new at this that I'm having trouble even knowing what to google. Can you help me figure out what I need to search for to find basic tutorials?

Offline

#4 2016-07-29 16:30:40

Durden
Member
Registered: 2011-06-19
Posts: 261

Re: curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

You need to have something actually running on a port before you can connect to it. You can install apache or nginx or something and start it, then create your connections. I suggest searching for apache in the wiki and get it up and  running.

Offline

#5 2016-07-29 20:19:06

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,355
Website

Re: curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

honeyplease wrote:

I'm trying to learn how to implement concurrent http post requests

In what context, or for what purpose?

I don't see how setting GET request or telnetting to your localhost would be a stepping stone to acheiving this.

If you want to just send a GET request, curl a real website - say google.com.  If you want to test a post request, you can also POST to any number of websites.

Setting up a web server on your localhost just so you can see how curl works from the command line goes well beyond overkill.  Setting up an apache server is a valuable experience in itself, but I suspect it is irrelevant to your real purposes.  So again, what are you really trying to do?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2016-07-30 12:18:07

honeyplease
Member
Registered: 2013-09-07
Posts: 33

Re: curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

Trilby wrote:
honeyplease wrote:

I'm trying to learn how to implement concurrent http post requests

In what context, or for what purpose?

I don't see how setting GET request or telnetting to your localhost would be a stepping stone to acheiving this.

If you want to just send a GET request, curl a real website - say google.com.  If you want to test a post request, you can also POST to any number of websites.

Setting up a web server on your localhost just so you can see how curl works from the command line goes well beyond overkill.  Setting up an apache server is a valuable experience in itself, but I suspect it is irrelevant to your real purposes.  So again, what are you really trying to do?


Fair enough. I need to speed up a job that at the end requires the transfer of a number of small files from a Spark cluster to our S3 bucket. My logic was that if I wanted to learn how to make concurrent requests it would be easiest to just ping my localhost, but it seems that that is actually the longer path.

I'll go with real websites then, thanks for the pointers, I appreciate them.

Offline

#7 2016-07-30 13:45:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,355
Website

Re: curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

I'm not really sure what you mean by concurrent requests.  Do you just mean multiple curl processes?  That's easy:

curl http://domain1.com/file1 > file1 &
culr http://domain2.com/file2 > file2 &
...

But you may find scp better than curl depending on your circumstances.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB