By mrbarnk
I am Getting error when sending https request to my node js server from php
cURL error 7: Failed to connect to api1.waapi.site port 9000: Connection refused
I am trying to send a request to https://api1.waapi.site:9000.
Please help me.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.