cURL error 7: Failed to connect to 127.0.0.1 port 8888: Connection refused (nginx) - linux

I got 3 curl calls in my laravel code
$fullNode = new \IEXBase\TronAPI\Provider\HttpProvider('http://127.0.0.1:8090');
$solidityNode = new \IEXBase\TronAPI\Provider\HttpProvider('http://127.0.0.1:8091');
$client = new \EOSPHP\EOSClient('http://127.0.0.1:8888');
$fullNode and $solidityNode work without any problem.
$client gets the following error message:
cURL error 7: Failed to connect to 127.0.0.1 port 8888: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
I checked this on my nginx machine:
sudo netstat -tulpn | grep LISTEN
The result did show 8090 and 8091 but not 8888.
I guess there is a problem with the port, it might not open? I'm not that experienced in working with ports, may someone can tell me where to go from here and if/ where i open the port for LISTEN to CURL? As said, this is a nginx linux machine.

Related

Logs to troubleshoot SSH tunneling errors

I am trying to troubleshoot connection errors when using SSH tunneling to connect to a rhel 8 EC2 server. Does anyone know of a log location on RHEL 8 that may contain more information when the connection is refused?
For reference I am using the following command (which works on all my other servers)
ssh -i -L 8745:IPOfServer:8443 ec2-user#IPOfServer
I get the error "open failed: connect failded: Connection refused
I can connect on 8080 but 8443 is refused even though the port is open and the application and firewalld are configured to listen on 8443 and 8080.
Thanks!!

How to open port 80 for node server on local machine?

How can I use the port 80 on my local Linux machine as the port of my node server?
The netstat command netstat -ptuln says the following about this port, while the node server is running:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN -
I found on this site some recommendations for the command sudo iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT. I executed this command but when I make a request with curl (curl 1.97.xxx.xxx.xx) it keeps responding with curl: (7) Failed to connect to xxxxxx port 80: Connection refused.
But using curl the following ways works: curl 0.0.0.0:80 or curl localhost:80.
My conclusion is, that I somehow have not opened the port correctly, but all I could find on the internet repetitively is the command I mentioned earlier.
I am aware of the fact that I could fix this easily by using an apache server, but I would like to make it without it.
Thank you!
Paste the output from
netstat -ptuln
command.I think the problem is that your web server runs on local address and can not be reachable for other machines in network.

Curl : connection refused

I got the following error while running curl:
curl: (7) Failed to connect to 127.0.0.1 port 8080: Connection
refused.
It seems that it is easy to debug, but, I didnt find how to solve it.
The adress 127.0.0.1 is mentioned in the file etc/hosts.
I am using curl version 7.47 on Ubuntu system.
Anyone has an idea about it ?
Thank you.
Make sure you have a service started and listening on the port.
netstat -ln | grep 8080
and
sudo netstat -tulpn
Try curl -v http://localhost:8080/ instead of 127.0.0.1
Listen to the port in one session and then open another session to test it with l$ curl -v http://localhost:8080/
It should work. That's how I worked although in l
Termux
You have to start the server first, before using curl. On 8/10 occasions that error message arises from not starting the server initially.
127.0.0.1 restricts access on every interface on port 8000 except development computer. change it to 0.0.0.0:8000 this will allow connection from curl.

Available UDP port

I have a RedHat node behind central firewall and I would like to be able to check if the firewall guys have opened a port for me on which still nothing in listening. When I want to check that for TCP port I use telnet and I get:
When not opened:
[myname#78 ~]$ telnet myhost 4080
Trying myhostip...
telnet: connect to address myhostip: Connection refused
telnet: Unable to connect to remote host: Connection refused
[myname#78 ~]$
When opened:
[myname#78 ~]$ telnet myhost 4080
Trying myhostip...
Connected to myhost (myhostip).
Escape character is '^]'.
So how do I do that for an UDP port?
You can accomplish this using Netcat which you can install on RHEL with yum(1) using command yum install nc.
After you've installed Netcat, put it in listen mode on the receiving end ie. on the host you're trying to reach from outside world. You can do this with nc -l -u <your external I -address> 4080. This command will hang on your terminal and wait for any connections to port you specify on the command line.
Then connect from outside world, using Netcat again, but this time leave the -l out ie. use netcat -u <your external IP address> 4080. This command will also just sit there. Typing any input now should be visible on the receiving end Netcat. In case it is not, something blocks the traffic between two the two hosts.

How to allow curl via a local proxy?

According the the Charles Proxy configuration page, you can manually set up a proxy if you use your localhost with port 8080.
The syntax is curl --proxy localhost:8080 http://google.com/
However, this is not working for me. Here is my syntax and results - i'm also using the -v option for debugging:
curl -v --proxy localhost:8080 http://google.com/
* About to connect() to proxy localhost port 8080 (#0)
* Trying 127.0.0.1... Connection refused
* Trying ::1... Connection refused
* Trying fe80::1... Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host
I can connect to localhost:8080 in the web browser, and the results are logged in the proxy. However this is not working, the connecting is refused and nothing is logged.
So far I have also tried:
- executing this as root
- using 127.0.0.1 instead of localhost
- using wget instead of curl
- disabling the system firewall
What am I doing wrong? What else can I try?
I had some success using port 8888:
curl http://www.google.com --proxy 127.0.0.1:8888
Connection refused would suggest that nothing is listening on port 8080. Charles has to be running (and listening on port 8080) for curl to be able to use it as a proxy. That or you've got a firewall actively blocking that port, preventing anything from connecting.

Resources