Google Cloud: HTTP Connection refused after VM restart - node.js

We have a node server hosted on Google Cloud.
It is handled by a VM instance on GCE and has open ports for HTTP/HTTPS.
It worked fine until I rebooted the VM instance...
If I try to connect to my API it now returns ERR: CONNECTION REFUSED
I'm pretty sure this is not happening because of the node server as logs are clearly showing the node server is not being accessed at all when connecting to it's IP or URL.
I can still SSH to the VM...
BTW: iptables empty and firewall rules double checked
Does someone know what could be the problem ?
I'd love some help... Thanks ! :D

Ok I'm going to answer my own question so it can help anyone facing the same issue...
For me it was my Apache server not being automatically restarted... As simple as that yeah ahah!
If you're not using Apache check any routes or so in iptables.
My node server was listening on 8080 port but HTTP and HTTPS requests are respectively 80 and 443...

Related

Cannot connect to website running on a node server at aws ec2 instance.

I have done this for windows instance earlier but not able to do the same on ubuntu.
I am running a Website on node server on an ubuntu aws-ec2 instance. But not able to connect to it from outside. The website is running fine on the instance and can be accessed using localhost. It is running on the port: 8080.
I have added this port number in inbound rules of security groups along with other port: 80. Screenshot of inbound rules.
I have also added the rule in ufw(firewall) to allow http request. Screenshot of ufw status.
I am trying to access the website through this link: http://ec2-52-87-224-241.compute-1.amazonaws.com:8080/ but receiving can't connect error.
It seems likes you're binding the server to the local interface in the following line:
...
http.createServer(onRequest).listen(port, "localhost");
...
Change that and it should work perfectly! When you bind the server object, Node accepts connections only from that interface.

Can't access basic Hello World application launched on Amazon EC2 windows server using NodeJS

I tried to look for solutions and most of them talk about adding HTTP, RDP, HTTPS to security group which I have already done. I have a basic hello world nodeJS application running on Amazon Windows Server 2012. I want to access this application using DNS but it's showing ERR_CONNECTION_TIMED_OUT in my local laptop browser.
Configuration:
I have RDP, HTTPS, HTTP, SSH, Custom TCP Protocol with 9000 port (nodeJS is running on port 9000) for inbound rules and for outbound default "All traffic" rule is present. I have not done any changes in the Windows Server 2012 configuration. WHen I run localhost:9000 in the windows server 2012 then server returns "Hello World" but when I try that on my local machine with DNS : 9000 then it says ERR_CONNECTION_TIMED_OUT
Thanks for everyone's support. Special thanks to Viccari. His suggestion (in the comments below the question) worked. I needed to add the port to the firewall. So basically after adding all the protocols to the security group, I had to add the new port on which the NodeJS is working, to the firewall in the server. Finally its working.

How do I get acces to server running on Bluemix Paas?

Few days ago I wanted to launch my own Agario server. I assumed not to spend any money on hosting/vps etc. After a long search I found Bluemix PaaS, I put open source Agario clone Ogar (https://github.com/OgarProject/Ogar) in them and server has already started in 1523 port, but when i try to connect to this server via agario site ( connect("ws://appname.eu-gb.mybluemix.net:1523") ) I can't connect. I tried also other ways e.g. prepared agar.io link (agar.io?ip=appname.eu-gb.mybluemix.net), but nothing worked.
Has anyone met similar problem?
Inbound traffic is only on standard HTTP/HTTPS ports 80/443. Bluemix will tell your application what port to listen on with the VCAP_APP_PORT env variable. Inbound requests are then mapped to that port. So, once you bind to the VCAP_APP_PORT port, you should be able to connect to : ws://appname.eu-gb.mybluemix.net

Amazon Nodejs webserver

I'm getting stuck here, so i have an amazon ec2 (standard redhat server) host up and working. i can connect to it personally no problem, however it cannot be connected to outside of my ip.
I've checked the rules and i have port 80 and 3000 open to 0.0.0.0/0 to be able to communicate, however outside of my computer (and computers in this network) i can not connect.
Everything I've found is about connecting to ssh which works fine, i have no rules in iptables, i haven't dealt much with them before, but since i can connect to the service i don't think its the issue.
summary:
Web server is running, i can connect from my computer to it, and any others in my local network, but nothing outside of it works.
i do have httpd installed as well as a simple forward from the browser to port 3000, however i cant connect to it either from outside my network.
so this is a new one for me, the dns forwarding works in houst, but not outside. so inside and outside here, i can use IP address to connect, but inside only i can connect with my dns lookup. not sure what caused this, but its not an amazon problem at least. going to look at that side.

Port Forwarding on website

I'm noob in this field, so please help me understand this:
I have my web application launched on port 8080. I thought that if i forward port 8080 and enter from web browser: myexternalipadress:8080/Index.html it should open my website. please tell me why i'm wrong
Ahh, hosting a website from your house is a fun thing indeed. In my experience, here is how I approach trouble shooting.
1.Making sure your server is configured properly.
Launch the server application
If your client and server are the same machine, make sure you can reach the server on localhost
Access the server from a different computer on your LAN, use your servers lan ip. 192.168.?.?:8080
If you can't get to it from another machine on your LAN, you may have firewall issues on the server
2.Making sure your network is configured properly
This is where port forwarding comes into play. Figure out the LAN ip of the server and log into the router.
Tell your router to forward the port (8080 in this case) to the server LAN ip address.
Test it by telling your friend to access your server on (WAN_IP:8080 in web browser)

Resources