Why node js project not run on IP address on alibaba cloud - node.js

I have successfully deployed node js project on Alibaba cloud and running on port 2021 and 2020 i have export that port no and also added on ECS on Alibaba cloud instance.
when i run command pm2 start 0,1 its status is online but when i hit that port no with IP address on browser its not working i google it and spend lots of time but not found any solution this is my first deployment on Alibaba cloud any help thanks in advance.

Based on the screenshots provided, the application is kept restarting so it seems like the application is not stable enough to accept the connections.
Try to curl the application on server with port and check if it returns the answers with the following
curl http://localhost:2000
curl http://localhost:2021
more on curl request can be found here https://blog.logrocket.com/an-intro-to-curl-the-basics-of-the-transfer-tool/
If there are no answers then try checking the logs by running
pm2 logs

Related

Deploy node.js in hostinger VPS but not running

I have my node app upload into hostinger and npm start run well.
But I still can't access http://my-ip:3000
node and npm and mysql have been installed
but no luck.
Am I missing some important steps?
this problem could come from your code || network
pm2 logs
see if there are some error logs
check on vps that if your service online
curl http://127.0.0.1:3000
if no resposne, you should fix the service code
check if your service runs on the right port
netstat -an | grep 3000

NodeJS and React - LAN connection not working

Description
I have a Node server and React App running on my notebook Ubuntu 18.04.
Notebook ip is 10.0.0.101
I tried to connect my desktop to this server on the same network
Desktop ip is 10.0.0.100
Node is running on PORT=3333
React is running on PORT=3000
I can ping my notebook from my desktop but when I try to connect to node using Insomnia or to http://10.0.0.101:3000 from my desktop I cannot reach.
Errors
When try to connect to backend with Insomnia
Error: Couldn't connect to server
When try to connect to app on 10.0.0.101:3000
ERR_CONNECTION_TIMED_OUT
What I've done
I already changed the node listen and specified the port and the ip but it didn't work.
I tried to use my phone as router and connect from my phone to react on my notebook and also didn't work.
I've tried so many things since I can't remember them all.
I'm also creating a react-native app and when I try to connect to my mobile using Expo, it just works using tunnel, but cannot get data from the backend.
Please save me.
Thanks
After making many failed attempts, I realized that the problem was in my notebook.
I checked my firewall and it was disabled and still cannot get acess to my notebook on LAN. But finally I discovered what have to be done
Solution
You have to open the specific port for TCP traffic
Ubuntu:
sudo ufw allow <PORT-NUMBER>/tcp
or for Red Hat Enterprise
firewall-cmd --add-port <PORT-NUMER>/tcp
Reference: Examples of how to open firewall ports

Node js deployement in Azure server could not be accesses outside using ip

I tried deploying a simple node js service in azure ubuntu using CLI,console logs says the server is up on port 8080(this same service works perfectly in my local machine),but when i tried to access the public ip from outside,it gives site can't be reached
Following was the output when i deployed my service
azureuser#myVM:~/drugdemo/user_service/drulistService$ vi server.js
azureuser#myVM:~/drugdemo/user_service/drulistService$ node server.js
App is listening on 8080
^C^C
azureuser#myVM:~/drugdemo/user_service/drulistService$ pm2 start server.js
[PM2] Starting
/home/azureuser/drugdemo/user_service/drulistService/server.js in fork_mode (1 instance)
[PM2] Done.
Use `pm2 show <id|name>` to get more details about an app
azureuser#myVM:~/drugdemo/user_service/drulistService$
Please help me with your suggections.
(I already tried changing 'localhost' to '0.0.0.0' and '127.0.0.1' but didn't work for me)
Thank you in advance
Make sure to open the firewall port via Azure as well and not just the server.
This may help: https://blogs.msdn.microsoft.com/pkirchner/2016/02/02/allow-incoming-web-traffic-to-web-server-in-azure-vm/

how to run nodejs app in vps with plesk enable

Hi guys im newbie in vps... I've bought an ovh not managed vps . I like to face problems... But I don't find any documents to these one. Is simple like I said I want to run a nodejs app in centos vps environment but I have enabled plesk.. and I saw in console running the app with the trace but I try to open website with the port and doesn't find anything.
http://vps406315.ovh.net
Thx for all guys
-----------------EDIT-------------------
I'm going to explain better,sorry for previous post.
There is no error, in my console all is ok. Like I said i have an CentOS VPS. Steps that I did:
Connect with PUTTY
Go to folder where is the NodeJS project.
I set the port to 8080
Write node index.js
The app is running and writing the right trace.
I use chrome to check the ip, and show me the default plesk page.
I use wget to check it, and with only http://92.222.71.137/. I attach
an screenshot
I tried to use with the port 8080 with the chrome and wget in putty,
and the response was the same.
In the other hand if I use http://92.222.71.137:8080/login with putty
download the right login.html, and the nodejs app write a trace
indicate me that someone connect to that page. But if I access with
chrome is not working.
Now I would like no know how to make access frome Chrome.
Thx 4 all and sorry for my newbie knowledge
You should give some other details on the configuration or eventual errors you get (both on the browser and the VPS) and how you run the node app (behind a web server, for example)
If you are not running you node app behind a web server, are the node app listening on the correct interface ? 127.0.0.1 and 92.222.71.137 (your site external address) are not the same.
On your VPS you can try to call the node app from the VPS itself using wget or cURL and looking for what happen in the app trace.
Finally it was easy... only i had to open a port to use with TCP, using
iptables -I INPUT -p tcp --dport 8856 --syn -j ACCEPT –

How to remote debug a node.js app on heroku?

I'm currently building a node.js chatbot which I then deploy on heroku.
The app uses webhooks which must be at a public URL that the servers can reach. Therefore, running the server locally on my machine will not work. Is there a way I can remote debug my app? Any tips?
I would consider using a tool to connect public URLs to an instance of your app running locally.
Option 1: ngrok
An easy one would be ngrok
Option 2: ssh reverse tunneling
If you have access to any Internet-facing server with ssh and admin rights to enable the GatewayPorts yes sshd configuration, you can do it with ssh remote tunneling. For example:
ssh -n -R 8080:localhost:3000 myserver.example.com
Will allow webhooks sent to http://myserver.example.com:8080 to tunnel to your local app listening on port 3000.
More details on ssh tunneling can be found here
You can indeed debug webhooks on your local computer using a free proxy service like ngrok.
If you want to debug it on Heroku, you can view your real-time logs using heroku logs --tail or use an addon service that stores logs.
Found an easier solution.
Install the LogDNA add-on, and then run the app and see the error stack trace.
then when you see the error and which line it happened on, it is pretty easy to find the problem.
Use Papertrail addon or can also use the logging options mentioned here https://devcenter.heroku.com/articles/logging.

Resources