I am Getting error when sending https request to my node js server from php

  • Posted January 28, 2020
  • API

I am Getting error when sending https request to my node js server from php

cURL error 7: Failed to connect to port 9000: Connection refused

I am trying to send a request to

Please help me.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @mrbarnk,

cURL error 7 is very explicit, it means for some reason you are not able to connect to the provider url. Most of the time it’s related to a firewall or some kind of a restriction issue.

Another suggestion would be that you haven’t started node to actually listen on port 9000. The last suggestion I have is that actually your firewall is blocking the access to this port.

To test the above theories, SSH to your droplet, start your NodeJS instance and type in the following

netstat -tulpen | grep 9000

If you have started the NodeJS application properly, you should see it in the output. If you do, it would mean your firewall is the issue. You’ll need to allow incoming traffic to the mentioned port. To do you need to run

iptables -A INPUT -p tcp --dport 9000 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT

If you don’t see any output, it would mean your NodeJS application hasn’t been started properly.

Regards, KDSys